我已经使用 tf_upgrade_v2 TF1 代码升级到 TF2。我是两者的菜鸟。我收到下一个错误:
RuntimeError: tf.placeholder() is not compatible with eager execution.
我有一些 tf.compat.v1.placeholder()
。
self.temperature = tf.compat.v1.placeholder_with_default(1., shape=())
self.edges_labels = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None, vertexes, vertexes))
self.nodes_labels = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None, vertexes))
self.embeddings = tf.compat.v1.placeholder(dtype=tf.float32, shape=(None, embedding_dim))
你能给我一些关于如何进行的建议吗?任何“快速”解决方案?还是我应该重新编码?
原文由 AMGMNPLK 发布,翻译遵循 CC BY-SA 4.0 许可协议
我在这里找到了一个简单的解决方案: 禁用 Tensorflow eager execution
基本上是:
tf.compat.v1.disable_eager_execution()
这样一来,您就可以禁用默认的 activate eager execution,并且您不需要再接触代码了。