Answers for "set_session` is not available when using tensorflow 2.0."

C
1

get_session` is not available when using TensorFlow 2.0.

Answer: In TF 2.0 you should use tf.compat.v1.Session() instead of tf.Session() Use the following code to get rid of the error in Tensorflow2.0:

import tensorflow as tf

tf.compat.v1.Session()
i.e. in your code above, replace this line self.sess = tf.compat.v1.keras.backend.get_session()of code with

self.sess = tf.compat.v1.Session()
Reference:

https://github.com/tensorflow/tensorflow/issues/26844#issuecomment-474038678
Posted by: Guest on June-25-2020

Code answers related to "set_session` is not available when using tensorflow 2.0."

Code answers related to "C"

Browse Popular Code Answers by Language