(self, dev)
| 53 | (_tuple_to_string(actual), _tuple_to_string(expect))) |
| 54 | |
| 55 | def _conv2d_helper(self, dev): |
| 56 | x = tensor.Tensor(shape=(2, 3, 3, 3), device=dev) |
| 57 | x.gaussian(0.0, 1.0) |
| 58 | y = layer.Conv2d(1, 2)(x) |
| 59 | |
| 60 | # frontend |
| 61 | model = sonnx.to_onnx([x], [y]) |
| 62 | # backend |
| 63 | sg_ir = sonnx.prepare(model, device=dev) |
| 64 | sg_ir.is_graph = True |
| 65 | y_t = sg_ir.run([x]) |
| 66 | |
| 67 | np.testing.assert_array_almost_equal(tensor.to_numpy(y), |
| 68 | tensor.to_numpy(y_t[0]), |
| 69 | decimal=5) |
| 70 | |
| 71 | def test_conv2d_cpu(self): |
| 72 | self._conv2d_helper(cpu_dev) |
no test coverage detected