kwea123 / nerf_pl

NeRF (Neural Radiance Fields) and NeRF in the Wild using pytorch-lightning
https://www.youtube.com/playlist?list=PLDV2CyUo4q-K02pNEyDr7DYpTQuka3mbV
MIT License
2.74k stars 483 forks source link

What does calling self(rays) do? #134

Closed exnx closed 2 years ago

exnx commented 2 years ago

Hi, I'm new to NeRF, but not new to Python. However, there's a line in the training code I've never seen before. Just wondering if anyone can shed some light on what this does? I didn't know you could call self like that.

The line is results = self(rays) in the train and val steps.

and it occurs here:((https://github.com/kwea123/nerf_pl/blob/c5910f84321eb5f72e3332507b0384f1b23f51f7/train.py#L123) )

Thank you!

kwea123 commented 2 years ago

This is an usage only valid for pytorch-lightning class. Basically it calls the forward function: https://github.com/kwea123/nerf_pl/blob/c5910f84321eb5f72e3332507b0384f1b23f51f7/train.py#L49 which renders the rays.

exnx commented 2 years ago

thanks!