image-analogies icon indicating copy to clipboard operation
image-analogies copied to clipboard

module 'tensorflow.python.framework.ops' has no attribute '_TensorLike'

Open taktikal17 opened this issue 7 years ago • 8 comments

Hi,

I was trying to run: make_image_analogy.py images/arch-mask.jpg images/arch.jpg images/arch-newmask.jpg out/arch

When I got this:

AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike'

Any idea how to fix that?

Thank you!

taktikal17 avatar Jun 05 '17 23:06 taktikal17

Hi, I had this same error when I was trying to import keras which uses tensorflow in the backend. Then I re-installed tensorflow with virtual environment. Now the error has gone. I am not sure if this may help. I followed the "Installing with Virtualenv" section in this site : https://www.tensorflow.org/install/install_linux And then maybe you can run the program in the virtual environment

RSudarsanan avatar Feb 17 '18 14:02 RSudarsanan

AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike'

Same error when using keras where tensorflow as backend

husnejahan avatar Jul 17 '18 16:07 husnejahan

Hi, I have tried by installing the tensorflow with virtualenv but the erroe was same. Any idea how to fix that?

(venv) pi@raspberrypi:~ $ python3 /home/pi/Desktop/final\ face/facenet\ face\ recognition/facenet.py Using TensorFlow backend.

** (facenet.py:27420): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files Traceback (most recent call last): File "/home/pi/Desktop/final face/facenet face recognition/facenet.py", line 19, in FRmodel = faceRecoModel(input_shape=(3, 96, 96)) File "/home/pi/Desktop/final face/facenet face recognition/inception_blocks_v2.py", line 229, in faceRecoModel X = ZeroPadding2D((3, 3))(X_input) File "/home/pi/.local/lib/python3.5/site-packages/keras/engine/base_layer.py", line 414, in call self.assert_input_compatibility(inputs) File "/home/pi/.local/lib/python3.5/site-packages/keras/engine/base_layer.py", line 279, in assert_input_compatibility K.is_keras_tensor(x) File "/home/pi/.local/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 470, in is_keras_tensor if not is_tensor(x): File "/home/pi/.local/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 478, in is_tensor return isinstance(x, tf_ops._TensorLike) or tf_ops.is_dense_tensor_like(x) AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike'

ghost avatar Sep 10 '18 12:09 ghost

I got the exact same error as @taktikal17 but with a keras.layers.LSTM instance. I am running this on OSX 10.11 so I had to install tensorflow/keras with virtualenv. Pretty sure my OS is my problem but it might not...

th4t-gi avatar Oct 07 '18 02:10 th4t-gi

i use version tensorflow==1.10.0 with no problem

wanlitengfei avatar Nov 02 '18 07:11 wanlitengfei

I am getting same error while using ImageAI

Jay2109 avatar Jul 31 '20 12:07 Jay2109

Just fix the imports like from keras import import Sequential

to this: tensorflow.keras import Sequential

Similarly for other imports starting with 'from keras'

Rahul2991 avatar Aug 09 '20 11:08 Rahul2991

I am getting same error while using ImageAI

I am also getting this error while using ImageAI. Referring to this.

mansi-aggarwal-2504 avatar Oct 15 '20 08:10 mansi-aggarwal-2504