import tensorflow as tf
a=tf.constant(2)
b=tf.constant(3)
c=a+b
sess=tf.Session(c)
sess.run()
I got the error message module 'tensorflow' has no attribute 'Session'
import tensorflow as tf
a=tf.constant(2)
b=tf.constant(3)
c=a+b
sess=tf.Session(c)
sess.run()
I got the error message module 'tensorflow' has no attribute 'Session'
From the official doc try the following:
# Build a graph.
a = tf.constant(5.0)
b = tf.constant(6.0)
c = a * b
# Launch the graph in a session.
sess = tf.compat.v1.Session()
# Evaluate the tensor `c`.
print(sess.run(c))
Try this way:
with tf.compat.v1.Session() as sess:
a = tf.constant(5.0)
b = tf.constant(6.0)
c = tf.multiply(a, b)
result = sess.run(c)
print(result)