📅  最后修改于: 2022-03-11 14:45:10.367000             🧑  作者: Mango
a = np.array([[1,2],[1,2]])
b = np.repeat(a[:, :, np.newaxis], 3, axis=2)
print(b[:, :, 0])
# [[1 2]
# [1 2]]
print(b[:, :, 1])
# [[1 2]
# [1 2]]
print(b[:, :, 2])
# [[1 2]
# [1 2]]