From 92ab25aff98fa4c4d96bf6993dcad37084a61151 Mon Sep 17 00:00:00 2001 From: ingra14m <1261238025@qq.com> Date: Fri, 10 Mar 2023 16:34:06 +0800 Subject: [PATCH] Fix bugs of training NeRF on the device without cuda --- run_nerf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/run_nerf.py b/run_nerf.py index bc270be86..51300f91c 100644 --- a/run_nerf.py +++ b/run_nerf.py @@ -873,6 +873,9 @@ def train(): if __name__=='__main__': - torch.set_default_tensor_type('torch.cuda.FloatTensor') + if torch.cuda.is_available(): + torch.set_default_tensor_type('torch.cuda.FloatTensor') + else: + torch.set_default_tensor_type('torch.FloatTensor') train()