torch-ngp
torch-ngp copied to clipboard
Question about render image and depth
Hello, thank you for your work and for answering questions. I have a question about the function which renders image and depth values based on input rays. to be more specific: renderer.py > class NeRFRenderer > run_cuda > raymarching.composite_rays when I pass a ray with requires_grad=True, depth is with .grad attribute, but the image is not. What is the reason? how can I have image as an output with .grad attribute?
Is it okay to delete all " .detach, torch_no_grad(), and @staticmethod" in the code?
@mah-asd Hi, do you mean composite_rays_train
or composite_rays
(for inference)? In fact both depth and image should have None
for .grad
, since they are not leaf nodes. Only tensor with is_leaf == True
and requires_grad == True
will get its grad after a later backward()
. Maybe you can check this.
Hi Ashawkey, Thank you for replying. I'm using rays_o and rays_d with required_grad = True as inputs, But I'm getting output without autograd attribute. Somewhere in the process, it becomes disabled. I'm using this line of code: **outputs = model.render(rays_o, rays_d, staged=True, bg_color=None, perturb=False, force_all_rays=False, vars(opt))