(self)
| 37 | np.testing.assert_allclose(out, expected, atol=1e-2) |
| 38 | |
| 39 | def test_add(self): |
| 40 | g = Graph() |
| 41 | a = g.input((4,)) |
| 42 | b = g.input((4,)) |
| 43 | y = a + b |
| 44 | |
| 45 | g.set_input(a, np.array([1, 2, 3, 4], dtype=np.float16)) |
| 46 | g.set_input(b, np.array([10, 20, 30, 40], dtype=np.float16)) |
| 47 | g.execute() |
| 48 | |
| 49 | out = y.numpy() |
| 50 | expected = np.array([11, 22, 33, 44], dtype=np.float16) |
| 51 | np.testing.assert_allclose(out, expected, atol=1e-2) |
| 52 | |
| 53 | def test_multiply(self): |
| 54 | g = Graph() |