Skip to content

Commit

Permalink
Fixing Pytorch 2 issues.
Browse files Browse the repository at this point in the history
Addressing a few bits of code that were causing issues with newer
versions of Pytorch.

Signed-off-by: Matthew Johnson <[email protected]>
  • Loading branch information
matajoh committed May 12, 2023
1 parent 7a5c0d7 commit 724969b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,5 @@ models
*.ps1
*.tsv
figures/*.png
figures/*.npz
figures/*.npz
scenepic.min.js
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ the requirements for the repository, ideally in a virtual environment. We
recommend using a version of Python >= 3.7. As this code heavily relies upon
PyTorch, you should install the correct version for your platform. The guide
[here](https://pytorch.org/get-started/locally/)
is very useful and I suggest you follow it closely. You may also find
[this site](https://www.lfd.uci.edu/~gohlke/pythonlibs/) helpful if you
are working on Windows. Once that is done, you can run the following:
is very useful and I suggest you follow it closely. Once that is done,
you can run the following:

```
pip install wheel
Expand Down
5 changes: 3 additions & 2 deletions fourier_feature_nets/image_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,12 @@ def render(self, samples: RaySamples) -> RenderResult:
Returns:
RenderResult: the ground truth render
"""
color = self.colors[samples.rays]
rays = samples.rays.to(self.colors.device)
color = self.colors[rays]
if self.alphas is None or self.mode == RayDataset.Mode.Dilate:
alpha = None
else:
alpha = self.alphas[samples.rays]
alpha = self.alphas[rays]
color = torch.where(alpha.unsqueeze(1) > 0, color,
torch.zeros_like(color))

Expand Down
2 changes: 1 addition & 1 deletion fourier_feature_nets/ray_caster.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
("train_psnr", float), ("val_psnr", float)])


class Raycaster:
class Raycaster(nn.Module):
"""Implementation of a volumetric raycaster."""

def __init__(self, model: nn.Module):
Expand Down

0 comments on commit 724969b

Please sign in to comment.