In TensorFlow, what is the difference between Session.run() and Tensor.eval() ?

In TensorFlow, what is the difference between Session.run() and Tensor.eval() ?

Asked on November 19, 2018 in Tensorflow.
Add Comment


  • 1 Answer(s)

        On the off chance that t is a Tensor object, t.eval() is shorthand for sess.run(t).

    sess = tf.Session()
    c = tf.constant(5.0)
    print sess.run(c)
     
    c = tf.constant(5.0)
    with tf.Session():
        print c.eval()
    

        When your code manages various graphs and sessions, it might be more clear to explicit calls to Session.run().

    Answered on November 19, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.