import numpy as np
x = np.array([[1,2,3],[11,12,13,],[22,23,24],[31,32,33]])
>>>x
array([[ 1, 2, 3],
[11, 12, 13],
[22, 23, 24],
[31, 32, 33]])
>>>x.reshape(2,6)
array([[ 1, 2, 3, 11, 12, 13],
[22, 23, 24, 31, 32, 33]])
x.reshape(-1)自动生成一列
>>>x.reshape(6,-1)
array([[ 1, 2],
[ 3, 11],
[12, 13],
[22, 23],
[24, 31],
[32, 33]])
>>>x.reshape(-1)
array([ 1, 2, 3, 11, 12, 13, 22, 23, 24, 31, 32, 33])
>>>x.reshape(-1, 4)
array([[ 1, 2, 3, 11],
[12, 13, 22, 23],
[24, 31, 32, 33]])
out = out.reshape(N, H, W, -1)
则其中的C通道数会自动确定