tf.minimum(A,B)

import tensorflow as tf
tf.minimum([5,2,3],[2,3,4])
 <tf.Tensor: shape=(3,), dtype=int32, numpy=array([2, 2, 3], dtype=int32)>
tf.minimum([[3,6,7],[5,2,3]],[2,3,4])
<tf.Tensor: shape=(2, 3), dtype=int32, numpy=
array([[2, 3, 4],
       [2, 2, 3]], dtype=int32)>
tf.minimum([[3,6,7],[5,2,3]],[[2,3,4],[1,2,1]])
<tf.Tensor: shape=(2, 3), dtype=int32, numpy=
array([[2, 3, 4],
       [1, 2, 1]], dtype=int32)>
tf.minimum([[3,6,7],[5,2,3]],[[2,3,4],[1,2,1],[3,1,1]])
InvalidArgumentError: Incompatible shapes: [2,3] vs. [3,3] [Op:Minimum]
tf.minimum(A,B), A的维度为mn,B的维度为kn,且m=n,或者 n=1,就可以比较大小
posted @ 2022-08-19 22:49  luoganttcc  阅读(22)  评论(0)    收藏  举报