From 125e7f3eee734c4d8b4b96851ba707a6f929e2ce Mon Sep 17 00:00:00 2001 From: ushio2021 <77770431+ushio2021@users.noreply.github.com> Date: Thu, 9 May 2024 00:30:27 +0800 Subject: [PATCH] Fix torch.no_grad torch.no_grad needs to be instantiated with parenthesis to function as a decorator (< PyTorch 2.1) --- nr3d_lib/models/fields/nerf/lotd_nerf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nr3d_lib/models/fields/nerf/lotd_nerf.py b/nr3d_lib/models/fields/nerf/lotd_nerf.py index eb92ddc..aca0f45 100644 --- a/nr3d_lib/models/fields/nerf/lotd_nerf.py +++ b/nr3d_lib/models/fields/nerf/lotd_nerf.py @@ -166,7 +166,7 @@ def forward_density(self, x: torch.Tensor, input_normalized=True): sigma = self.density_activation(output[..., 0]) return dict(sigma=sigma) - @torch.no_grad + @torch.no_grad() def query_density(self, x: torch.Tensor): # NOTE: x must be in range [-1,1] h = self.encoding(x)