我想把一个3,1024,1024,1024和1,1024,1024的张量组合起来,形成一个4,1024,1024的张量。
这是将RGB图像的通道组合成每个像素的r,g,b,d格式的深度图像。
我目前正试图这样做:
tensor = tf.concat([imageTensor, depthTensor], axis=2)但我收到了错误
InvalidArgumentError: ConcatOp : Dimensions of inputs should match: shape[0] = [3,1024,1024] vs. shape[1] = [1,1024,1024] [Op:ConcatV2]我只是想知道该怎么做?
发布于 2022-03-31 05:48:59
您希望在axis=0上连接:
import tensorflow as tf
t1 = tf.random.uniform((3, 1024, 1024))
t2 = tf.random.uniform((1, 1024, 1024))
final_tensor = tf.concat((t1, t2), axis=0)
print(final_tensor.shape)
(4, 1024, 1024)https://stackoverflow.com/questions/71685987
复制相似问题