(self, dev)
| 207 | self._add_helper(gpu_dev) |
| 208 | |
| 209 | def _concat_helper(self, dev): |
| 210 | X1 = np.random.randn(3, 4, 5).astype(np.float32) |
| 211 | X2 = np.random.randn(3, 4, 5).astype(np.float32) |
| 212 | |
| 213 | x1 = tensor.from_numpy(X1) |
| 214 | x2 = tensor.from_numpy(X2) |
| 215 | x1.to_device(dev) |
| 216 | x2.to_device(dev) |
| 217 | y = autograd.Concat()(x1, x2)[0] |
| 218 | |
| 219 | # frontend |
| 220 | model = sonnx.to_onnx([x1, x2], [y]) |
| 221 | |
| 222 | # backend |
| 223 | sg_ir = sonnx.prepare(model, device=dev) |
| 224 | sg_ir.is_graph = True |
| 225 | y_t = sg_ir.run([x1, x2]) |
| 226 | |
| 227 | np.testing.assert_array_almost_equal(tensor.to_numpy(y), |
| 228 | tensor.to_numpy(y_t[0]), |
| 229 | decimal=5) |
| 230 | |
| 231 | def test_concat_cpu(self): |
| 232 | self._concat_helper(cpu_dev) |
no test coverage detected