2.30

import numpy as np
a = np.array([[0, 3, 4], [1, 6, 4]])
b = a.sum()
c1 = sum(a)
c2 = np.sum(a, axis = 0)
c3 = np.sum(a, axis = 1, keepdims = True)

print(c1)

print(c2.shape, c3.shape)

posted @ 2024-10-27 23:30  世梦  阅读(18)  评论(0)    收藏  举报