Kim Seong Hyeon
Kim Seong Hyeon

Reputation: 109

cupy sum method gives strange value

I run following code

import cupy as cp
x = cp.array([2.0, 3.0])
print(cp.sum(x))

Then it says 0.0 as output. Moreover,

x = cp.array([1, 2, 3, 4, 5, 6])
print(cp.sum(x))

gives 72340172838076673 as output. what's problem? And how can I use sum method correctly?

Upvotes: 0

Views: 182

Answers (1)

oubaydos
oubaydos

Reputation: 192

cupy.sum(a, axis=None, dtype=None, out=None, keepdims=False)

Returns the sum of an array along given axes. and the default axis is None, which means it'll return 0 if applied without specifying axis.

Upvotes: -1

Related Questions