import numpy as np
# 创建数组
arr1 = np.array([[0, 0, 0, 0], [1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]])
# print(arr1)
# print(arr1.shape)
arr2 = np.array([1, 2, 3, 4])
# print(arr2)
# print(arr2.shape)
# 执行相加
arr_new = arr1+arr2
print(arr_new)
numpy广播机制
最新推荐文章于 2024-08-27 13:05:24 发布