(self,dev)
| 2882 | self.ceil_test(gpu_dev) |
| 2883 | |
| 2884 | def floor_test(self,dev): |
| 2885 | X = np.array([-1.9,1.2]).astype(np.float32) |
| 2886 | DY = np.ones((2),dtype=np.float32) |
| 2887 | y = np.floor(X) |
| 2888 | x = tensor.from_numpy(X) |
| 2889 | dy = tensor.from_numpy(DY) |
| 2890 | x.to_device(dev) |
| 2891 | dy.to_device(dev) |
| 2892 | |
| 2893 | result = autograd.floor(x) |
| 2894 | dx = result.creator.backward(dy.data) |
| 2895 | DX = np.zeros((2),dtype=np.float32) |
| 2896 | np.testing.assert_array_almost_equal(tensor.to_numpy(result),y,decimal=5) |
| 2897 | np.testing.assert_array_almost_equal(tensor.to_numpy(tensor.from_raw_tensor(dx)),DX,decimal=5) |
| 2898 | |
| 2899 | def test_floor_cpu(self): |
| 2900 | self.floor_test(cpu_dev) |
no test coverage detected