autonomousvision / differentiable_volumetric_rendering

This repository contains the code for the CVPR 2020 paper "Differentiable Volumetric Rendering: Learning Implicit 3D Representations without 3D Supervision"
http://www.cvlibs.net/publications/Niemeyer2020CVPR.pdf
MIT License
798 stars 90 forks source link

Implementation questions #17

Closed Kai-46 closed 4 years ago

Kai-46 commented 4 years ago

Thanks for sharing the great work! I have a silly question regarding the implementation of depth gradient. It seems that the forward procedure of DepthFunction(torch.autograd.Function) is explicitly executed by calling DepthFunction.apply. However, I wonder how the backward procedure is called in the codebase. Any help is appreciated! Thanks.

m-niemeyer commented 4 years ago

Hi @Kai-46 , thanks for your question. We define the depth function as our own autograd function. This means that you have to define a forward pass as well as a backward pass, and just apply your function - the gradients are then back propagated like for any standard PyTorch autograd function. This example from the official PyTorch webpage might also be helpful.