(self, dev)
| 2853 | self.slice_test(gpu_dev) |
| 2854 | |
| 2855 | def ceil_test(self, dev): |
| 2856 | X = np.array([-1.5, 1.2]).astype(np.float32) |
| 2857 | DY = np.ones((2), dtype=np.float32) |
| 2858 | y = np.ceil(X) |
| 2859 | |
| 2860 | x = tensor.from_numpy(X) |
| 2861 | dy = tensor.from_numpy(DY) |
| 2862 | x.to_device(dev) |
| 2863 | dy.to_device(dev) |
| 2864 | |
| 2865 | result = autograd.ceil(x) |
| 2866 | dx = result.creator.backward(dy.data) |
| 2867 | DX = np.zeros((2), dtype=np.float32) |
| 2868 | |
| 2869 | np.testing.assert_array_almost_equal(tensor.to_numpy(result), |
| 2870 | y, |
| 2871 | decimal=5) |
| 2872 | np.testing.assert_array_almost_equal(tensor.to_numpy( |
| 2873 | tensor.from_raw_tensor(dx)), |
| 2874 | DX, |
| 2875 | decimal=5) |
| 2876 | |
| 2877 | def test_ceil_cpu(self): |
| 2878 | self.ceil_test(cpu_dev) |
no test coverage detected