Répéter le tableau le long de l'axe nouvel axe

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