问题:ValueError: tf.function-decorated function tried to create variables on non-first call.
解决方案-当您尝试在TF 2.0中使用函数装饰器时,请在导入TensorFlow后立即启用运行功能。我通过tf.config.experimental_run_functions_eagerly(True)在之后添加来解决此问题import tensorflow。
您可以tf.config.experimental_run_functions_eagerly在tensorflow官方网站链接中找到更多信息。