(self, dev)
| 267 | self._matmul_helper(gpu_dev) |
| 268 | |
| 269 | def _max_pool_helper(self, dev): |
| 270 | x = tensor.Tensor(shape=(2, 3, 4, 4), device=dev) |
| 271 | x.gaussian(0.0, 1.0) |
| 272 | y = layer.MaxPool2d(2, 2, 0)(x) |
| 273 | |
| 274 | # frontend |
| 275 | model = sonnx.to_onnx([x], [y]) |
| 276 | # print('The model is:\n{}'.format(model)) |
| 277 | |
| 278 | # backend |
| 279 | sg_ir = sonnx.prepare(model, device=dev) |
| 280 | sg_ir.is_graph = True |
| 281 | y_t = sg_ir.run([x]) |
| 282 | |
| 283 | np.testing.assert_array_almost_equal(tensor.to_numpy(y), |
| 284 | tensor.to_numpy(y_t[0]), |
| 285 | decimal=5) |
| 286 | |
| 287 | def test_max_pool_cpu(self): |
| 288 | self._max_pool_helper(cpu_dev) |
no test coverage detected