Drop backward compatibility for Torch 1.13 (#1948)

* Drop backward compatibility for Torch 1.13

* Fix lint errors
This commit is contained in:
Jonáš Kulhánek authored and GitHub committed 2023-05-18 09:12:51 +02:00
1 parent ea3f25d662
commit 08e3a1f1a6
4 files changed
+3 -18

No files matched your search

+1 -3
View File
@@ -21,8 +21,6 @@ import torch
from jaxtyping import Bool, Float
from torch import Tensor
from nerfstudio.utils.misc import torch_compile
def components_from_spherical_harmonics(
levels: int, directions: Float[Tensor, "*batch 3"]
@@ -199,7 +197,7 @@ def expected_sin(x_means: torch.Tensor, x_vars: torch.Tensor) -> torch.Tensor:
return torch.exp(-0.5 * x_vars) * torch.sin(x_means)
@torch_compile(dynamic=True, mode="reduce-overhead", backend="eager")
@torch.compile(dynamic=True, mode="reduce-overhead", backend="eager")
def intersect_aabb(
origins: torch.Tensor,
directions: torch.Tensor,
-10
View File
@@ -158,13 +158,3 @@ def strtobool(val) -> bool:
FMI https://stackoverflow.com/a/715468
"""
return val.lower() in ("yes", "y", "true", "t", "on", "1")
if hasattr(torch, "compile"):
# PyTorch 2.0+
torch_compile = torch.compile
else:
# PyTorch 1.x
def torch_compile(*args, **kwargs):
"""Fall back to jit script if using pytorch 1.x, args ignored"""
return torch.jit.script