(self, dev)
| 1042 | self._Greater_helper(gpu_dev) |
| 1043 | |
| 1044 | def _HardSigmoid_helper(self, dev): |
| 1045 | x = np.array([-0.9, -0.3, -0.1, 0.1, 0.5, |
| 1046 | 0.9]).reshape(3, 2).astype(np.float32) |
| 1047 | a = 0.2 |
| 1048 | g = 0.5 |
| 1049 | |
| 1050 | x = tensor.from_numpy(x) |
| 1051 | x.to_device(dev) |
| 1052 | y = autograd.hardsigmoid(x, a, g) |
| 1053 | |
| 1054 | # frontend |
| 1055 | model = sonnx.to_onnx([x], [y]) |
| 1056 | # print('The model is:\n{}'.format(model)) |
| 1057 | |
| 1058 | # backend |
| 1059 | sg_ir = sonnx.prepare(model, device=dev) |
| 1060 | sg_ir.is_graph = True |
| 1061 | y_t = sg_ir.run([x]) |
| 1062 | |
| 1063 | np.testing.assert_array_almost_equal(tensor.to_numpy(y), |
| 1064 | tensor.to_numpy(y_t[0]), |
| 1065 | decimal=5) |
| 1066 | |
| 1067 | def test_HardSigmoid_cpu(self): |
| 1068 | self._HardSigmoid_helper(cpu_dev) |
no test coverage detected