如何组合numpy 3d阵列形状(326,25,16)和1d阵列形状(326,)

2024-09-20 22:20:28 发布

您现在位置:Python中文网/ 问答频道 /正文

如何组合numpy 3d阵列形状(326,25,16)和1d阵列形状(326,) 数组形状(326,25,16)是CNN的输入,数组形状(326,16)是标签


Tags: numpy标签数组cnn形状
1条回答
网友
1楼 · 发布于 2024-09-20 22:20:28

关于您要做的事情,我的最佳嘉宾是复制和调整数组的大小

# same dimensions as your array
a=np.random.randn(326)
# then you can tile (repeat) your array to have the same shape 
# of your other array to do element-wise operations or something else 
b=np.tile(a.reshape(-1,1,1),(1,25,16))

变量b的形状现在是(326, 25, 16)

相关问题 更多 >

    热门问题