{"id":295,"hash":"161061a82f015f7c4cbf081c00b01df43c678128e3e79e504a9603b1055dce1c","pattern":"RuntimeError: tf.placeholder() is not compatible with eager execution","full_message":"I have upgraded with tf_upgrade_v2 TF1 code to TF2. I'm a noob with both. I got the next error:\n\nRuntimeError: tf.placeholder() is not compatible with eager execution.\n\nI have some tf.compat.v1.placeholder().\n\nself.temperature = tf.compat.v1.placeholder_with_default(1., shape=())\nself.edges_labels = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None, vertexes, vertexes))\nself.nodes_labels = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None, vertexes))\nself.embeddings = tf.compat.v1.placeholder(dtype=tf.float32, shape=(None, embedding_dim))\n\nCould you give me any advice about how to proceed? Any \"fast\" solutions? or should I to recode this?","ecosystem":"pypi","package_name":"python-3.x","package_version":null,"solution":"I found an easy solution here: disable Tensorflow eager execution\n\nBasicaly it is:\n\ntf.compat.v1.disable_eager_execution()\n\nWith this, you disable the default activate eager execution and you don't need to touch the code much more.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/56561734/runtimeerror-tf-placeholder-is-not-compatible-with-eager-execution","votes":89,"created_at":"2026-04-19T04:41:46.114253+00:00","updated_at":"2026-04-19T04:51:57.736047+00:00"}