keras-coordconv
keras-coordconv copied to clipboard
Tensorflow 2.2 gives error: TypeError: An op outside of the function building code is being passed a "Graph" tensor.
Hi, I added CoordConv layers to UNet model and it gives following error right before model training:
TypeError: An op outside of the function building code is being passed a "Graph" tensor. It is possible to have Graph tensors leak out of the function building context by including a tf.init_scope in your function building code. For example, the following function will fail: @tf.function def has_init_scope(): my_constant = tf.constant(1.) with tf.init_scope(): added = my_constant * 2 The graph tensor has name: model/coordinate_channel2d/stack:0
Same issue. Tensorflow version 1.15
same issue
I had the same issue in Tensorflow 2.4. I solved by replacing the calls to function "K.ones" for "tf.ones" in the source code. It was also necessary to add a line to import tensorflow: "import tensorflow as tf". I hope this can help.
switching to tf.ones did not solve the issue for me on Tensorflow 2.4.1 however downgrading to 2.2 solved it.