Powtórz tablicę wzdłuż nowej osi

a = np.array([[1, 2], [1, 2]])
# indexing with np.newaxis inserts a new 3rd dimension, 
# which we then repeat the array along
b = np.repeat(a[:, :, np.newaxis], 3, axis=2)
print(b.shape)
# (2, 2, 3)
Real Raccoon