(self, dev)
| 1723 | self._reduceMean_helper(gpu_dev) |
| 1724 | |
| 1725 | def _squeeze_helper(self, dev): |
| 1726 | X = np.random.randn(3, 1, 2, 1, 1) |
| 1727 | |
| 1728 | x = tensor.from_numpy(X) |
| 1729 | x.to_device(dev) |
| 1730 | y = autograd.squeeze(x, [1, 3, 4]) |
| 1731 | |
| 1732 | # frontend |
| 1733 | model = sonnx.to_onnx([x], [y]) |
| 1734 | # print('The model is:\n{}'.format(model)) |
| 1735 | |
| 1736 | # backend |
| 1737 | sg_ir = sonnx.prepare(model, device=dev) |
| 1738 | sg_ir.is_graph = True |
| 1739 | y_t = sg_ir.run([x]) |
| 1740 | |
| 1741 | np.testing.assert_array_almost_equal( |
| 1742 | tensor.to_numpy(y).shape, |
| 1743 | tensor.to_numpy(y_t[0]).shape) |
| 1744 | |
| 1745 | def test_squeeze_cpu(self): |
| 1746 | self._squeeze_helper(cpu_dev) |
no test coverage detected