【发布时间】:2022-01-10 22:55:19
【问题描述】:
我有 2 个张量,例如:
a = tf.constant([[1, 2, 3], [1, 2, 3]])
b = tf.constant([1, 2, 3, 4, 5])
我想要的输出是:
<tf.Tensor: shape=(4, 2), dtype=int64, numpy=
array([[1, 2, 3, 0, 0],
[1, 2, 3, 0, 0],
[1, 2, 3, 4, 5]], dtype=int64)>
但是当我尝试tf.concat([a, b], axis=0) 时,我得到了这个错误:
InvalidArgumentError: ConcatOp : Dimensions of inputs should match: shape[0] = [2,3] vs. shape[1] = [1,5] [Op:ConcatV2] name: concat
【问题讨论】:
-
这能回答你的问题吗? Keras Concatenate layer dimensions acting up
-
@A.Najafi 我认为不是。 Lambda,如果我没记错的话,不能“扩展”你的张量维度添加 0 值,对吧?
标签: python tensorflow tensorflow2.0