Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我运行以下代码
import cupy as cp x = cp.array([2.0, 3.0]) print(cp.sum(x))
然后它说 0.0 作为输出。而且,
x = cp.array([1, 2, 3, 4, 5, 6]) print(cp.sum(x))
给出 72340172838076673 作为输出。什么问题?以及如何正确使用 sum 方法?
cupy.sum(a, axis=None, dtype=None, out=None, keepdims=False)
返回沿给定轴的数组的总和。并且默认轴为无,这意味着如果在未指定轴的情况下应用它将返回 0。