import tensorflow as tf; import numpy as np; x = tf.constant([[1, 2, 3], [4, 5, 6]])cc=tf.transpose(x)init = tf.initialize_all_variables()sess = tf.Session()sess.run(init) # Very importantprint(sess.run(x))print(sess.run(cc))
[[1 2 3] [4 5 6]][[1 4] [2 5] [3 6]]