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

Function test_basic

imperative/python/test/unit/core/test_tensor_wrapper.py:17–27  ·  view source on GitHub ↗
(is_varnode)

Source from the content-addressed store, hash-verified

15
16@pytest.mark.parametrize("is_varnode", [True, False])
17def test_basic(is_varnode):
18 if is_varnode:
19 network = Network()
20 else:
21 network = None
22
23 x_np = np.random.rand(10).astype("float32")
24 x = make_tensor(x_np, network)
25 y = x * x
26 y_np = y.numpy()
27 np.testing.assert_almost_equal(y_np, x_np * x_np)
28
29
30@pytest.mark.parametrize("is_varnode", [True, False])

Callers

nothing calls this directly

Calls 4

NetworkClass · 0.90
make_tensorFunction · 0.90
astypeMethod · 0.45
numpyMethod · 0.45

Tested by

no test coverage detected