yenchenlin / nerf-pytorch

A PyTorch implementation of NeRF (Neural Radiance Fields) that reproduces the results.
MIT License
5.33k stars 1.04k forks source link

A little problem about create a gird #105

Open sdu-huanhq opened 1 year ago

sdu-huanhq commented 1 year ago

Hello: I have a little promble: In get_rays( )(nerf_helper.py), you first use torch.meshgrid to create a gird, and then transpose it. But in run_nerf.py you create the coordinates with the following code:

coords = torch.stack(
                        torch.meshgrid(
                            torch.linspace(H//2 - dH, H//2 + dH - 1, 2*dH), 
                            torch.linspace(W//2 - dW, W//2 + dW - 1, 2*dW)
                        ), -1)

Why not transpose it before using torch.stack?