(self, dev)
| 3482 | self.where_helper(gpu_dev) |
| 3483 | |
| 3484 | def rounde_helper(self, dev): |
| 3485 | X = np.array([ |
| 3486 | 0.1, 0.5, 0.9, 1.2, 1.5, 1.8, 2.3, 2.5, 2.7, -1.1, -1.5, -1.9, -2.2, |
| 3487 | -2.5, -2.8 |
| 3488 | ]).astype(np.float32) |
| 3489 | x = tensor.from_numpy(X) |
| 3490 | x.to_device(dev) |
| 3491 | |
| 3492 | y_t = np.array( |
| 3493 | [0., 0., 1., 1., 2., 2., 2., 2., 3., -1., -2., -2., -2., -2., |
| 3494 | -3.]).astype(np.float32) |
| 3495 | dy = tensor.from_numpy(y_t) |
| 3496 | dy.to_device(dev) |
| 3497 | |
| 3498 | y = autograd.rounde(x) |
| 3499 | np.testing.assert_array_almost_equal(tensor.to_numpy(y), y_t) |
| 3500 | |
| 3501 | def test_rounde_cpu(self): |
| 3502 | self.rounde_helper(cpu_dev) |
no test coverage detected