MCPcopy Create free account
hub / github.com/numpy/numpy / test_mean_values

Method test_mean_values

numpy/core/tests/test_multiarray.py:6221–6230  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

6219 assert_equal(f(A, axis=axis), np.zeros([]))
6220
6221 def test_mean_values(self):
6222 for mat in [self.rmat, self.cmat, self.omat]:
6223 for axis in [0, 1]:
6224 tgt = mat.sum(axis=axis)
6225 res = _mean(mat, axis=axis) * mat.shape[axis]
6226 assert_almost_equal(res, tgt)
6227 for axis in [None]:
6228 tgt = mat.sum(axis=axis)
6229 res = _mean(mat, axis=axis) * np.prod(mat.shape)
6230 assert_almost_equal(res, tgt)
6231
6232 def test_mean_float16(self):
6233 # This fail if the sum inside mean is done in float16 instead

Callers

nothing calls this directly

Calls 4

assert_almost_equalFunction · 0.90
_meanFunction · 0.70
sumMethod · 0.45
prodMethod · 0.45

Tested by

no test coverage detected