这里-1是指未设定行数,程序自动计算,所以这里-1表示任一正整数
example
reshape(-1, 1) 表示(任意行,1列),4行4列变为16行1列
reshape(1, -1) 表示(1行,任意列),4行4列变为1行16列
reshape(-1, 2) 表示(任意行,2列),4行4列变为8行2列
reshape(-1, 1) 等多用于不知道具体行数或列数时
这里-1是指未设定行数,程序自动计算,所以这里-1表示任一正整数
example
reshape(-1, 1) 表示(任意行,1列),4行4列变为16行1列
reshape(1, -1) 表示(1行,任意列),4行4列变为1行16列
reshape(-1, 2) 表示(任意行,2列),4行4列变为8行2列
reshape(-1, 1) 等多用于不知道具体行数或列数时