While debugging a code, I came across something I couldn't explain; There was a method call without any name, only instance's name. Somewhere in the code instance is defined:
model = RadianceFieldRenderer(...)
The RadianceFieldRenderer
class has two public methods:
def precache_rays(
self,
cache_cameras: List[CamerasBase],
cache_camera_hashes: List[str],
):
and
def forward(
self,
camera_hash: Optional[str],
camera: CamerasBase,
image: torch.Tensor,
) -> Tuple[dict, dict]:
Here there is a call to forward()
method without it's name:
nerf_out, metrics = model(
camera_idx if cfg.data.precache_rays else None,
camera,
image,
)
Does python infer which method I wish to call given the the number of arguments and returns?