我有大小为A (1, 1, 59)
和B (1, 95, 59)
的数组。我想要拼接这两个数组,并使得拼接后的数组大小为(1, 96, 59)
。
np.concatenate((A, B),axis =0)
无法正常工作,错误为ValueError: all the input array dimensions except for the concatenation axis must match exactly
我有大小为A (1, 1, 59)
和B (1, 95, 59)
的数组。我想要拼接这两个数组,并使得拼接后的数组大小为(1, 96, 59)
。
np.concatenate((A, B),axis =0)
无法正常工作,错误为ValueError: all the input array dimensions except for the concatenation axis must match exactly
>>> import numpy as np
>>> A = np.ones((1,1,59))
>>> B = np.zeros((1,56,59))
>>> np.concatenate((A, B), axis=1)
array([[[ 1., 1., 1., ..., 1., 1., 1.],
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.],
...,
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.]]])
>>> _.shape
(1, 57, 59)