Как насчет использования петли for
вместе с numpy.fill_diagonal
?
In [33]: zeros = np.zeros((5, 3, 3))
# desired values to be filled along the diagonals;
# can also be 1D numpy arrays instead of Python lists
In [34]: diagonals = [[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]
In [35]: for idx, diag in enumerate(diagonals):
...: np.fill_diagonal(zeros[idx], diag)
...:
In [36]: zeros
Out[36]:
array([[[1., 0., 0.],
[0., 2., 0.],
[0., 0., 3.]],
[[1., 0., 0.],
[0., 2., 0.],
[0., 0., 3.]],
[[1., 0., 0.],
[0., 2., 0.],
[0., 0., 3.]],
[[1., 0., 0.],
[0., 2., 0.],
[0., 0., 3.]],
[[1., 0., 0.],
[0., 2., 0.],
[0., 0., 3.]]])