how to fix : module 'tensorflow' has no attribute 'Session'

13,520

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))
Share:
13,520
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years
    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'