- reshape用法
reshape将数组转换为指定维度的数组。如shape=(3,3,2),变为shape=(6,3)
纬度可以按,3,3,2随意相乘组合。
>>> d.shape
(3, 3, 2)
>>> d
array([[[0.15806541, 0.83728057],
[0.07068964, 0.08968969],
[0.78407501, 0.00971791]],
[[0.66565757, 0.01989591],
[0.41523051, 0.04005441],
[0.40336547, 0.45136037]],
[[0.98080303, 0.71608698],
[0.80330452, 0.55264494],
[0.97022443, 0.82303241]]])
>>> d_new = d.reshape(6, 3)
>>> d_new
array([[0.15806541, 0.83728057, 0.07068964],
[0.08968969, 0.78407501, 0.00971791],
[0.66565757, 0.01989591, 0.41523051],
[0.04005441, 0.40336547, 0.45136037],
[0.98080303, 0.71608698, 0.80330452],
[0.55264494, 0.97022443, 0.82303241]])