import numpy as np a = np.arange(24).reshape(2, 3, 4) b = np.arange(12).reshape(3, 4) c = a + b flattened_c = c.flatten().copy() print("矩阵 a:\n", a) print("\n矩阵 b:\n", b) print("\n矩阵 c(a + b):\n", c) print("\n展平后的矩阵 c:\n", flattened_c)