MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / test_x

Function test_x

imperative/python/test/unit/core/test_tensor_wrapper.py:88–92  ·  view source on GitHub ↗
(x_np)

Source from the content-addressed store, hash-verified

86 network = None
87
88 def test_x(x_np):
89 for m in ["sum", "prod", "min", "max", "mean"]:
90 x = make_tensor(x_np, network)
91 y = getattr(x, m)(axis=-1, keepdims=True)
92 np.testing.assert_almost_equal(y.numpy(), getattr(x_np, m)(-1), decimal=6)
93
94 test_x((10 * np.random.rand(10) + 1).astype("int32"))
95 test_x(np.random.rand(10).astype("float32"))

Callers 1

test_reduceFunction · 0.85

Calls 2

make_tensorFunction · 0.90
numpyMethod · 0.45

Tested by

no test coverage detected