Check out example codes for "get_session` is not available when using TensorFlow 2.0.". It will help you in understanding the concepts better.

Code Example 1

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

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()

Learn ReactJs, React Native from