tf.less返回两个张量各元素比较(x<y)得到的真假值组成的张量。

import tensorflow as tf
A=[[1,2,3],
   [4,5,6]]
t = tf.shape(A)
i=[[1,2,3],
   [1,2,3]]
r = tf.less(i, A)
with tf.Session() as sess:
    print(sess.run(t))
    print(sess.run(r))

结果

[2 3]
[[False False False]
 [ True  True  True]]