我已使用 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))
你能给我一些关于如何进行的建议吗?任何“快速”解决方案?还是我应该重新编码?
最佳答案
我在这里找到了一个简单的解决方案:disable Tensorflow eager execution
基本上是:tf.compat.v1.disable_eager_execution()
有了这个,您可以禁用默认的激活急切执行,并且您不需要更多地接触代码。
关于python - RuntimeError : tf. placeholder() 与急切执行不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56561734/