(self, dev)
| 103 | self._relu_helper(gpu_dev) |
| 104 | |
| 105 | def _avg_pool_helper(self, dev): |
| 106 | x = tensor.Tensor(shape=(2, 3, 3, 3), device=dev) |
| 107 | x.gaussian(0.0, 1.0) |
| 108 | y = layer.AvgPool2d(3, 1, 2)(x) |
| 109 | |
| 110 | # frontend |
| 111 | model = sonnx.to_onnx([x], [y]) |
| 112 | |
| 113 | # backend |
| 114 | sg_ir = sonnx.prepare(model, device=dev) |
| 115 | sg_ir.is_graph = True |
| 116 | y_t = sg_ir.run([x]) |
| 117 | |
| 118 | np.testing.assert_array_almost_equal(tensor.to_numpy(y), |
| 119 | tensor.to_numpy(y_t[0]), |
| 120 | decimal=5) |
| 121 | |
| 122 | def test_avg_pool_cpu(self): |
| 123 | self._avg_pool_helper(cpu_dev) |
no test coverage detected