我实现了图像分类的 TFF 代码。TFF 版本 0.18.0,我这样写:
iterative_process = tff.learning.build_federated_averaging_process(model_fn, server_optimizer_fn=lambda: tf.keras.optimizers.SGD(learning_rate=1.0), client_optimizer_fn=lambda: tf.keras.optimizers.SGD(learning_rate=0.001))
state = iterative_process.initialize()
但我发现这个警告:
WARNING:tensorflow:AutoGraph could not transform <function <lambda> at 0x7fca141a6d08> and will run it as-is.
Cause: could not parse the source code of <function <lambda> at 0x7fca141a6d08>: found multiple definitions with identical signatures at the location. This error may be avoided by defining each lambda on a single line and with unique argument names.
Match 0:
(lambda : tf.keras.optimizers.SGD(learning_rate=1.0))
Match 1:
(lambda : tf.keras.optimizers.SGD(learning_rate=0.001))
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
那么请问我该如何避免这个警告。谢谢