(self, dev=gpu_dev)
| 906 | self._round_even(gpu_dev) |
| 907 | |
| 908 | def _round_even(self, dev=gpu_dev): |
| 909 | q=np.array([0.1, 0.5, 0.9, 1.2, 1.5, |
| 910 | 1.8, 2.3, 2.5, 2.7, -1.1, |
| 911 | -1.5, -1.9, -2.2, -2.5, -2.8]).astype(np.float32) |
| 912 | ans = np.array([0., 0., 1., 1., 2., |
| 913 | 2., 2., 2., 3., -1., |
| 914 | -2., -2., -2., -2., -3.]).astype(np.float32) |
| 915 | |
| 916 | x = tensor.Tensor(shape=q.shape, device=dev) |
| 917 | x.copy_from_numpy(q) |
| 918 | y = tensor._call_singa_func(singa_api.RoundE, x.data) |
| 919 | np.testing.assert_array_almost_equal(ans, tensor.to_numpy(y)) |
| 920 | |
| 921 | |
| 922 | if __name__ == '__main__': |
no test coverage detected