(self, dev)
| 983 | self._Sub_helper(gpu_dev) |
| 984 | |
| 985 | def _Sqrt_helper(self, dev): |
| 986 | X = np.array([0.1, 1.0, 0.4, 4.0, 0.9, |
| 987 | 9.0]).reshape(3, 2).astype(np.float32) |
| 988 | x = tensor.from_numpy(X) |
| 989 | x.to_device(dev) |
| 990 | y = autograd.sqrt(x) |
| 991 | |
| 992 | # frontend |
| 993 | model = sonnx.to_onnx([x], [y]) |
| 994 | # print('The model is:\n{}'.format(model)) |
| 995 | |
| 996 | # backend |
| 997 | sg_ir = sonnx.prepare(model, device=dev, init_inputs=X) |
| 998 | sg_ir.is_graph = True |
| 999 | y_t = sg_ir.run([x]) |
| 1000 | |
| 1001 | np.testing.assert_array_almost_equal(tensor.to_numpy(y), |
| 1002 | tensor.to_numpy(y_t[0]), |
| 1003 | decimal=5) |
| 1004 | |
| 1005 | def test_Sqrt_cpu(self): |
| 1006 | self._Sqrt_helper(cpu_dev) |
no test coverage detected