(is_varnode, shape_a, shape_b)
| 46 | "shape_a, shape_b", [((4,), (4,)), ((10, 4), (4, 10)), ((3, 10, 4), (3, 4, 10)),], |
| 47 | ) |
| 48 | def test_matmul(is_varnode, shape_a, shape_b): |
| 49 | if is_varnode: |
| 50 | network = Network() |
| 51 | else: |
| 52 | network = None |
| 53 | |
| 54 | A = make_tensor(np.random.rand(*shape_a).astype("float32"), network) |
| 55 | B = make_tensor(np.random.rand(*shape_b).astype("float32"), network) |
| 56 | C = A @ B |
| 57 | if is_varnode: |
| 58 | np.testing.assert_almost_equal( |
| 59 | get_var_value(C), get_var_value(A) @ get_var_value(B), decimal=6 |
| 60 | ) |
| 61 | else: |
| 62 | np.testing.assert_almost_equal(C.numpy(), A.numpy() @ B.numpy(), decimal=6) |
| 63 | |
| 64 | |
| 65 | @pytest.mark.parametrize("is_varnode", [True, False]) |
nothing calls this directly
no test coverage detected