Skip to content

Commit 823ab75

Browse files
EmGarrfacebook-github-bot
authored andcommitted
Simplify _xy_grid computation in raysampling
Summary: Remove the need of tuple and reversed in the raysampling xy_grid computation Reviewed By: bottler Differential Revision: D45269342 fbshipit-source-id: d0e4c0923b9a2cca674b35e8d64862043a0eab3b
1 parent 32e1992 commit 823ab75

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

pytorch3d/renderer/implicit/raysampling.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,11 @@ def __init__(
109109
self._stratified_sampling = stratified_sampling
110110

111111
# get the initial grid of image xy coords
112-
_xy_grid = torch.stack(
113-
tuple(
114-
reversed(
115-
meshgrid_ij(
116-
torch.linspace(min_y, max_y, image_height, dtype=torch.float32),
117-
torch.linspace(min_x, max_x, image_width, dtype=torch.float32),
118-
)
119-
)
120-
),
121-
dim=-1,
112+
y, x = meshgrid_ij(
113+
torch.linspace(min_y, max_y, image_height, dtype=torch.float32),
114+
torch.linspace(min_x, max_x, image_width, dtype=torch.float32),
122115
)
116+
_xy_grid = torch.stack([x, y], dim=-1)
123117

124118
self.register_buffer("_xy_grid", _xy_grid, persistent=False)
125119

0 commit comments

Comments
 (0)