-
tensorflow
中的坑-不同维数的张量可以比较- 张量
a
是一维的[1,2,3,4,5,6]
,张量b
是二维的[[1],[2],[3],[4],[5],[6]]
,它们俩居然可以比较。。。我说我的模型准确率怎么那么低。。。如下>>> a <tf.Tensor: shape=(6,), dtype=int32, numpy=array([1, 2, 3, 4, 5, 6])> >>> b = tf.constant([[1],[2],[3],[4],[5],[6]]) >>> b <tf.Tensor: shape=(6, 1), dtype=int32, numpy= array([[1], [2], [3], [4], [5], [6]])> >>> # 居然可以比较。。。害的我准确率那么低。。。 >>> tf.equal(a,b) <tf.Tensor: shape=(6, 6), dtype=bool, numpy= array([[ True, False, False, False, False, False], [False, True, False, False, False, False], [False, False, True, False, False, False], [False, False, False, True, False, False], [False, False, False, False, True, False], [False, False, False, False, False, True]])>
- 张量
tensorflow中的坑-不同维数的张量可以比较
最新推荐文章于 2024-04-24 12:49:53 发布