这里有几种可能性:
>>> import numpy as np
>>>
>>> rows = np.zeros((6, 6, 6), dtype=int)
>>> np.einsum('iij->ij', rows)[...] = 1
>>> cols = np.zeros((6, 6, 6), dtype=int)
>>> np.einsum('iji->ij', cols)[...] = 1
>>>
>>> for block in (rows, cols):
... for m in zip(*block):
... print(list(map(''.join, map(map, 6*(str,), m))))
... print()
...
['111111', '000000', '000000', '000000', '000000', '000000']
['000000', '111111', '000000', '000000', '000000', '000000']
['000000', '000000', '111111', '000000', '000000', '000000']
['000000', '000000', '000000', '111111', '000000', '000000']
['000000', '000000', '000000', '000000', '111111', '000000']
['000000', '000000', '000000', '000000', '000000', '111111']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
>>>
>>> row0 = np.outer(0==np.arange(6), np.ones(6, dtype=int))
>>> rows =[np.roll(row0, i, axis=0) for i in range(6)]
>>> col0 = np.outer(np.ones(6, dtype=int), 0==np.arange(6))
>>> cols =[np.roll(col0, i, axis=1) for i in range(6)]
>>>
>>> for block in (rows, cols):
... for m in zip(*block):
... print(list(map(''.join, map(map, 6*(str,), m))))
... print()
...
['111111', '000000', '000000', '000000', '000000', '000000']
['000000', '111111', '000000', '000000', '000000', '000000']
['000000', '000000', '111111', '000000', '000000', '000000']
['000000', '000000', '000000', '111111', '000000', '000000']
['000000', '000000', '000000', '000000', '111111', '000000']
['000000', '000000', '000000', '000000', '000000', '111111']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
>>>
>>> rows =[np.add.outer(i==np.arange(6), np.zeros(6, dtype=int)) for i in range(6)]
>>> cols =[np.add.outer(np.zeros(6, dtype=int), i==np.arange(6)) for i in range(6)]
>>>
>>> for block in (rows, cols):
... for m in zip(*block):
... print(list(map(''.join, map(map, 6*(str,), m))))
... print()
...
['111111', '000000', '000000', '000000', '000000', '000000']
['000000', '111111', '000000', '000000', '000000', '000000']
['000000', '000000', '111111', '000000', '000000', '000000']
['000000', '000000', '000000', '111111', '000000', '000000']
['000000', '000000', '000000', '000000', '111111', '000000']
['000000', '000000', '000000', '000000', '000000', '111111']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
>>> rows = np.empty((6, 6, 6), dtype=int)
>>> rows[...] = np.identity(6)[..., None]
>>> cols = np.empty((6, 6, 6), dtype=int)
>>> cols[...] = np.identity(6)[:, None]
>>>
>>> for block in (rows, cols):
... for m in zip(*block):
... print(list(map(''.join, map(map, 6*(str,), m))))
... print()
...
['111111', '000000', '000000', '000000', '000000', '000000']
['000000', '111111', '000000', '000000', '000000', '000000']
['000000', '000000', '111111', '000000', '000000', '000000']
['000000', '000000', '000000', '111111', '000000', '000000']
['000000', '000000', '000000', '000000', '111111', '000000']
['000000', '000000', '000000', '000000', '000000', '111111']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']
['100000', '010000', '001000', '000100', '000010', '000001']