(self, dev)
| 1669 | self._dropout_helper(gpu_dev) |
| 1670 | |
| 1671 | def _reduceSum_helper(self, dev): |
| 1672 | X = np.random.randn(3, 4, 5).astype(np.float32) |
| 1673 | |
| 1674 | x = tensor.from_numpy(X) |
| 1675 | x.to_device(dev) |
| 1676 | y = autograd.reduce_sum(x, None, 1) |
| 1677 | |
| 1678 | # frontend |
| 1679 | model = sonnx.to_onnx([x], [y]) |
| 1680 | # print('The model is:\n{}'.format(model)) |
| 1681 | |
| 1682 | # backend |
| 1683 | sg_ir = sonnx.prepare(model, device=dev) |
| 1684 | sg_ir.is_graph = True |
| 1685 | y_t = sg_ir.run([x]) |
| 1686 | |
| 1687 | np.testing.assert_array_almost_equal( |
| 1688 | tensor.to_numpy(y).shape, |
| 1689 | tensor.to_numpy(y_t[0]).shape) |
| 1690 | |
| 1691 | def test_reduceSum_cpu(self): |
| 1692 | self._reduceSum_helper(cpu_dev) |
no test coverage detected