Tips
tf.rank()
import tensorflow as tf
X = tf.constant([[1,2,3], [4,5,6], [7,8,9]])
# Explicitly, the rank of the matrix X should be 3 but that's not the case for the tensor X.
with tf.Session() as sess:
Xrank = sess.run(tf.rank(X))
print("The rank of tensor X is {rank}.".format(rank=Xrank))The rank of tensor X is 2.Last updated