module 'tensorflow' has no attribute 'log'
12,256
Solution 1
loss = tf.keras.losses.categorical_crossentropy
I also faced a similar issue then i called tensorflow with each Keras object and it resolved it
Solution 2
substitute tf.math.log
for tf.log
in tf 2.0
.
Solution 3
If you know the exact line where tf.log
is, replace it with tf.math.log
.
if not, you can use this guide to Automatically upgrade code to TensorFlow 2
Related videos on Youtube
Author by
neelima golla
Updated on June 04, 2022Comments
-
neelima golla almost 2 years
fashion_model.compile( loss = keras.losses.categorical_crossentropy, optimizer = tf.keras.optimizers.Adam(), metrics = ['accuracy'] )
When I execute this line of code I am facing the error
module 'tensorflow' has no attribute 'log'
and my tensorflow version is 2.0
-
Akash Basudevan over 4 yearsCan you post the complete code?
-