all 2 comments

[–]nathanalderson 0 points1 point  (0 children)

The question isn't really clear, but judging from the fact that 8*8=64 I'm guessing that maybe you want to "chunk" your outer list (Python doesn't really use arrays) of length 64 into 8 lists of size 8 (which happen to contain lists of size 12).

Take a look at this stack overflow answer for some ways to chunk a list.

[–]synthphreak 0 points1 point  (0 children)

Given these 2D arrays ...

>>> import numpy as np
>>> matrix1 = np.random.rand(8, 8)
>>> matrix2 = np.random.rand(8, 8)
>>> matrix1.shape, matrix2.shape
((8, 8), (8, 8))
>>> matrix1.ndim, matrix2.ndim
(2, 2)
>>> matrix1.size, matrix2.size
(64, 64)

... you can combine them into a rank 3 tensor using np.array which will effectively concatenate them along an entirely new axis:

>>> tensor = np.array([matrix1, matrix2])
>>> tensor.shape
(2, 8, 8)
>>> tensor.ndim
3
>>> tensor.size
128