Guest User

Untitled

a guest
Nov 20th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. n = tf.norm(X, ord=2, axis=0) # n.get_shape() is (?, ?, 3), not (?)
  2. n = tf.norm(X, ord=2, axis=[1,2,3]) # ValueError
  3.  
  4. import tensorflow as tf
  5. import numpy as np
  6.  
  7. c = tf.constant(np.random.rand(3, 2, 3, 6))
  8. d = tf.norm(c, ord=2)
  9.  
  10. with tf.Session() as sess:
  11. print sess.run(d)
  12.  
  13. import tensorflow as tf
  14. import numpy as np
  15.  
  16. batch = tf.constant(np.random.rand(3, 2, 3, 6))
  17.  
  18. x = tf.norm(batch, axis=3)
  19. x = tf.norm(x, axis=2)
  20. x = tf.norm(x, axis=1)
  21.  
  22. with tf.Session() as sess:
  23. result = sess.run(x)
  24. print(result)
Add Comment
Please, Sign In to add comment