a = tf.compat.v1.constant(5.0)
b = tf.compat.v1.constant(6.0)
sum1 = a + b
g = tf.compat.v1.Graph()
with g.as_default():
# Define operations and tensors in `g`.
hello = tf.compat.v1.constant('hello')
assert hello.graph is g
sess = tf.compat.v1.Session(graph=g)
print(sess.run(sum1))
tensorflow-gpu2.0 i don't know why. i am a beginner of tensorflow
After import tensorflow need disable eager execution, like below:
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
It's worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With