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

Method test_mean_values

numpy/_core/tests/test_multiarray.py:7185–7195  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

7183 assert_equal(f(A, axis=axis), np.zeros([]))
7184
7185 def test_mean_values(self):
7186 rmat, cmat, omat = self._create_data()
7187 for mat in [rmat, cmat, omat]:
7188 for axis in [0, 1]:
7189 tgt = mat.sum(axis=axis)
7190 res = _mean(mat, axis=axis) * mat.shape[axis]
7191 assert_almost_equal(res, tgt)
7192 for axis in [None]:
7193 tgt = mat.sum(axis=axis)
7194 res = _mean(mat, axis=axis) * np.prod(mat.shape)
7195 assert_almost_equal(res, tgt)
7196
7197 def test_mean_float16(self):
7198 # This fail if the sum inside mean is done in float16 instead

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected