import numpy as np
a = np.random.randint(1, 10, [3, 2, 3, 4])
c = np.concatenate(a, axis=1)
print(np.shape(a), "axis=1", np.shape(c))
d = np.concatenate(a, axis=0)
print(np.shape(a), "axis=0", np.shape(d))
e = np.concatenate(a, axis=2)
print(np.shape(a), "axis=2", np.shape(e))
打印结果:
(3, 2, 3, 4) axis=1 (2, 9, 4)
(3, 2, 3, 4) axis=0 (6, 3, 4)
(3, 2, 3, 4) axis=2 (2, 3, 12)