|
9 | 9 |
|
10 | 10 | import torch |
11 | 11 | from common_testing import TestCaseMixin |
| 12 | +from pytorch3d.common.compat import meshgrid_ij |
12 | 13 | from pytorch3d.ops import eyes |
13 | 14 | from pytorch3d.renderer import ( |
14 | 15 | MonteCarloRaysampler, |
@@ -86,7 +87,7 @@ def _get_ndc_grid(self, h, w, device): |
86 | 87 | min_y = range_y - half_pix_height |
87 | 88 | max_y = -range_y + half_pix_height |
88 | 89 |
|
89 | | - y_grid, x_grid = torch.meshgrid( |
| 90 | + y_grid, x_grid = meshgrid_ij( |
90 | 91 | torch.linspace(min_y, max_y, h, dtype=torch.float32), |
91 | 92 | torch.linspace(min_x, max_x, w, dtype=torch.float32), |
92 | 93 | ) |
@@ -540,7 +541,7 @@ def test_jiggle(self): |
540 | 541 | self.assertTupleEqual(out.shape, data.shape) |
541 | 542 |
|
542 | 543 | # Check `out` is in ascending order |
543 | | - self.assertGreater(torch.diff(out, dim=-1).min(), 0) |
| 544 | + self.assertGreater((out[..., 1:] - out[..., :-1]).min(), 0) |
544 | 545 |
|
545 | 546 | self.assertConstant(out[..., :-1] < data[..., 1:], True) |
546 | 547 | self.assertConstant(data[..., :-1] < out[..., 1:], True) |
|
0 commit comments