(self, dev)
| 1533 | self._xor_helper(gpu_dev) |
| 1534 | |
| 1535 | def _not_helper(self, dev): |
| 1536 | x = np.array([1.0, -1.0, 0, -0.1, 0, |
| 1537 | -7.0]).reshape(3, 2).astype(np.float32) |
| 1538 | x = tensor.from_numpy(x) |
| 1539 | x.to_device(dev) |
| 1540 | |
| 1541 | y = autograd._not(x) |
| 1542 | |
| 1543 | # frontend |
| 1544 | model = sonnx.to_onnx([x], [y]) |
| 1545 | # print('The model is:\n{}'.format(model)) |
| 1546 | |
| 1547 | # backend |
| 1548 | sg_ir = sonnx.prepare(model, device=dev) |
| 1549 | sg_ir.is_graph = True |
| 1550 | y_t = sg_ir.run([x]) |
| 1551 | |
| 1552 | np.testing.assert_array_almost_equal(tensor.to_numpy(y), |
| 1553 | tensor.to_numpy(y_t[0]), |
| 1554 | decimal=5) |
| 1555 | |
| 1556 | def test_not_cpu(self): |
| 1557 | self._not_helper(cpu_dev) |
no test coverage detected