Tensor object has no attribute keras_shape
I had a similar issue when I changed my computer with a different tensorflow version.
What solved it for me was using .shape
instead of ._keras_shape
Depending on the version of tensorflow/keras and/or how you import them (from keras
, from tensorflow.keras
or from tensorflow.python.keras
) it appears that the attributes names can differ.
If you change this:
from keras.models import Model
to this:
from tensorflow.keras.models import Model
your code will be fine.
* or *
Change this:
from tensorflow.python.keras.layers import Input
to this:
from keras.layers import Input