Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. # GOOD CODE
  2.  
  3. import tensorflow as tf
  4.  
  5. # Build a graph.
  6. a = tf.constant(5.0)
  7. b = tf.constant(6.0)
  8. c = a * b
  9.  
  10. # Launch the graph in a session.
  11. sess = tf.compat.v1.Session()
  12.  
  13. # Evaluate the tensor `c`.
  14. print(sess.run(c))
  15.  
  16. # BAD CODE
  17.  
  18. import tensorflow as tf
  19.  
  20. # Build a graph.
  21. a = tf.constant(5.0)
  22. b = tf.constant(6.0)
  23. c = a * b
  24.  
  25. # Launch the graph in a session.
  26. sess = tf.compat.v1.Session()
  27.  
  28. # Evaluate the tensor `c`.
  29.  
  30. sess.run(c)
  31. print(c)
  32.  
  33. Tensor("mul:0", shape=(), dtype=float32)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement