将字节数组转换为矩阵数组

时间:2019-01-14 04:32:29

标签: python-3.x numpy

我有一个数组的numpy数组,我需要将此矩阵转换为矩阵数组,每个矩阵都表示为25x25。

数组数组:

[[1 0 0 0 1 0 0 1]
 [0 0 0 0 0 0 0 0]
 [0 1 1 1 0 1 1 1]
 ...
 [0 0 0 0 0 0 0 0]
 [0 1 1 1 0 0 0 0]
 [0 0 0 0 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 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 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 0] ... [0 0 0 0 0 0 0 0]] (25x25)

 [[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 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 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 0 0 0 0 0 0]] (25x25)

 [[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 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 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 0 0 0 0 0 0]] (25x25)
  ] 

0 个答案:

没有答案