Guest User

Untitled

a guest
Jun 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. import tensorflow as tf
  2.  
  3. a = tf.constant(3.5)
  4. b = tf.constant(4.5)
  5. c = a * b
  6.  
  7. # this is what you are doing
  8. print(c)
  9. # out: Tensor("mul_3:0", shape=(), dtype=float32)
  10.  
  11. # this is what you want
  12. with tf.Session() as sess:
  13. result = c.eval()
  14. # Or use sess.run:
  15. # result = sess.run(c)
  16.  
  17. print(result)
  18. # out: 15.75
  19.  
  20. print(type(result))
  21. # out: <class 'numpy.float32'>
Add Comment
Please, Sign In to add comment