How to optimize camera and light parameters in pytorch3d?

I want to optimize the light and camera parameters in pytorch3d, but find them to be defined at initial state, so how can I optimize them iteratively ?
for example, the camera is defined as follows:

def SfMPerspectiveCameras(
    focal_length=1.0, principal_point=((0.0, 0.0),), R=_R, T=_R, device="cpu"
):
    """
    SfMPerspectiveCameras has been DEPRECATED. Use PerspectiveCameras instead.
    Preserving SfMPerspectiveCameras for backward compatibility.
    """

    warnings.warn(
        """SfMPerspectiveCameras is deprecated,
        Use PerspectiveCameras instead.
        SfMPerspectiveCameras will be removed in future releases.""",
        PendingDeprecationWarning,
    )

    return PerspectiveCameras(
        focal_length=focal_length,
        principal_point=principal_point,
        R=R,
        T=T,
        device=device,
    )

then the focal_length and principal_point can not be learned by optimization.

1 Like