numpy扩充数组维度 expand_dims(a, axis)中,a为numpy数组,axis为需添加维度的轴,a.shape将在该轴显示为1。 例如: arr1=np.array([1,2,3,4,5,6,6]) arr1.shape为(6,),arr1的值为【1,2,3,4,5,6,6】 当使用此函数之后: arr2=np.expand_dims(arr1,axis=0)之后,则在0轴显示为1,arr2.sha...
numpy 数组扩充维度 dataX = np.expand_dims(np.random.randint(0,10,size=100), axis = 0) dataY = np.expand_dims(np.random.randint(0,10,size=100), axis = 0)