From 74954ee77e42416ef97341ae11a7a71b8eb3d0be Mon Sep 17 00:00:00 2001 From: msksbr Date: Fri, 18 Oct 2024 22:15:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=AC=A1=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=9D=A5=E5=92=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/homework2/main.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/homework2/main.py b/test/homework2/main.py index 450cd98..e9c661a 100644 --- a/test/homework2/main.py +++ b/test/homework2/main.py @@ -1,14 +1,14 @@ import numpy as np -a = np.arange(2 * 3 * 4).reshape(2, 3, 4) +a = np.arange(24).reshape(2, 3, 4) -b = np.arange(12).reshape(2, 6) +b = np.arange(12).reshape(3, 4) -c = a + b.reshape(2, 3, 4) +c = a + b -c_flattened = c.flatten(copy=True) +flattened_c = c.flatten().copy() -print("a\n", a) -print("b\n", b) -print("c\n", c) -print("c_flattened\n", c_flattened) +print("矩阵 a:\n", a) +print("\n矩阵 b:\n", b) +print("\n矩阵 c(a + b):\n", c) +print("\n展平后的矩阵 c:\n", flattened_c)