MCPcopy Index your code
hub / github.com/numpy/numpy / sum_to_0d

Method sum_to_0d

numpy/lib/tests/test_shape_base.py:190–193  ·  view source on GitHub ↗

Sum x, returning a 0d array of the same class

(x)

Source from the content-addressed store, hash-verified

188
189 def test_0d_array(self, cls=np.ndarray):
190 def sum_to_0d(x):
191 """ Sum x, returning a 0d array of the same class """
192 assert_equal(x.ndim, 1)
193 return np.squeeze(np.sum(x, keepdims=True))
194 a = np.ones((6, 3)).view(cls)
195 res = apply_along_axis(sum_to_0d, 0, a)
196 assert_(isinstance(res, cls))

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
squeezeMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected