我正在尝试使用联邦代码来构建我自己的联邦学习算法。但是我遇到了一个问题。在官方教程中,它定义了 Model Spec 如下:
MODEL_SPEC = collections.OrderedDict(
filter1 = tf.TensorSpec(shape=weights[0].shape, dtype=tf.float32),
bias1 = tf.TensorSpec(shape=weights[1].shape, dtype=tf.float32),
filter2 = tf.TensorSpec(shape=weights[2].shape, dtype=tf.float32),
bias2 = tf.TensorSpec(shape=weights[3].shape, dtype=tf.float32),
weight1 = tf.TensorSpec(shape=weights[4].shape, dtype=tf.float32),
bias3 = tf.TensorSpec(shape=weights[5].shape, dtype=tf.float32)
)
MODEL_TYPE = tff.to_type(MODEL_SPEC)
我想知道是否需要将模型作为 OrderedDict 输入。我可以将模型输入为可训练的 Keras 模型吗?
谢谢!