(self, dev)
| 1642 | self._constantOfShape_helper(gpu_dev) |
| 1643 | |
| 1644 | def _dropout_helper(self, dev): |
| 1645 | X = np.random.randn(3, 4, 5).astype(np.float32) |
| 1646 | |
| 1647 | x = tensor.from_numpy(X) |
| 1648 | x.to_device(dev) |
| 1649 | y = autograd.dropout(x, 0.5) |
| 1650 | |
| 1651 | # frontend |
| 1652 | model = sonnx.to_onnx([x], [y]) |
| 1653 | # print('The model is:\n{}'.format(model)) |
| 1654 | |
| 1655 | # backend |
| 1656 | sg_ir = sonnx.prepare(model, device=dev) |
| 1657 | sg_ir.is_graph = True |
| 1658 | y_t = sg_ir.run([x]) |
| 1659 | |
| 1660 | self.check_shape( |
| 1661 | tensor.to_numpy(y).shape, |
| 1662 | tensor.to_numpy(y_t[0]).shape) |
| 1663 | |
| 1664 | def test_dropout_cpu(self): |
| 1665 | self._dropout_helper(cpu_dev) |
no test coverage detected