(self, dev)
| 860 | # self._Equal_helper(gpu_dev) |
| 861 | |
| 862 | def _Less_helper(self, dev): |
| 863 | x0 = np.array([-0.9, -0.3, -0.1, 0.1, 0.5, |
| 864 | 0.9]).reshape(3, 2).astype(np.float32) |
| 865 | x1 = np.array([0, -0.3, 0, 0.1, 0, 0.9]).reshape(3, |
| 866 | 2).astype(np.float32) |
| 867 | x0 = tensor.from_numpy(x0) |
| 868 | x1 = tensor.from_numpy(x1) |
| 869 | x0.to_device(dev) |
| 870 | x1.to_device(dev) |
| 871 | |
| 872 | y = autograd.less(x0, x1) |
| 873 | |
| 874 | # frontend |
| 875 | model = sonnx.to_onnx([x0, x1], [y]) |
| 876 | # print('The model is:\n{}'.format(model)) |
| 877 | |
| 878 | # backend |
| 879 | sg_ir = sonnx.prepare(model, device=dev) |
| 880 | sg_ir.is_graph = True |
| 881 | y_t = sg_ir.run([x0, x1]) |
| 882 | |
| 883 | np.testing.assert_array_almost_equal(tensor.to_numpy(y), |
| 884 | tensor.to_numpy(y_t[0]), |
| 885 | decimal=5) |
| 886 | |
| 887 | def test_Less_cpu(self): |
| 888 | self._Less_helper(cpu_dev) |
no test coverage detected