(self, dev)
| 893 | |
| 894 | |
| 895 | def _Sign_helper(self, dev): |
| 896 | x = np.array([0.8, -1.2, 3.3, -3.6, -0.5, |
| 897 | 0.5]).reshape(3, 2).astype(np.float32) |
| 898 | x = tensor.from_numpy(x) |
| 899 | y = autograd.sign(x) |
| 900 | |
| 901 | # frontend |
| 902 | model = sonnx.to_onnx([x], [y]) |
| 903 | # print('The model is:\n{}'.format(model)) |
| 904 | |
| 905 | # backend |
| 906 | sg_ir = sonnx.prepare(model, device=dev) |
| 907 | sg_ir.is_graph = True |
| 908 | y_t = sg_ir.run([x]) |
| 909 | |
| 910 | np.testing.assert_array_almost_equal(tensor.to_numpy(y), |
| 911 | tensor.to_numpy(y_t[0]), |
| 912 | decimal=5) |
| 913 | |
| 914 | def test_Sign_cpu(self): |
| 915 | self._Sign_helper(cpu_dev) |
no test coverage detected