Skip to content

Commit

Permalink
Fix user backend flag bad assignment
Browse files Browse the repository at this point in the history
Fixes `user_requested_backend` bad assignment when backend is not specified
- Changed argument `backend` to `backend_name`
- Check `backend_name` to set `user_requested_backend` instead of the created backend object
  • Loading branch information
LvisRoot authored Apr 10, 2023
1 parent a1b2ad4 commit 5a07a55
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions kaolin/render/camera/extrinsics.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def from_view_matrix(cls,
dtype: torch.dtype = default_dtype,
device: Union[torch.device, str] = None,
requires_grad: bool = False,
backend: str = None) -> CameraExtrinsics:
backend_name: str = None) -> CameraExtrinsics:
r"""Constructs the extrinsics from a given view matrix
of shape :math:`(\text{num_cameras}, 4, 4)`.
Expand Down Expand Up @@ -457,8 +457,8 @@ def from_view_matrix(cls,
If device is None, the default torch device will be used
requires_grad (bool):
Sets the requires_grad field for the params tensor of the CameraExtrinsics
backend (str):
The backend used to manage the internal representation of the extrinsics, and how it is converted
backend_name (str):
The backend's name used to manage the internal representation of the extrinsics, and how it is converted
to a view matrix.
Different representations are tuned to varied use cases:
speed, differentiability w.r.t rigid transformations space, and so forth.
Expand All @@ -469,9 +469,9 @@ def from_view_matrix(cls,
(CameraExtrinsics): the camera extrinsics
"""
view_matrix = cls._to_tensor_input(view_matrix, device=device, dtype=dtype)
backend = cls._make_backend(view_matrix, dtype, device, requires_grad, backend)
backend = cls._make_backend(view_matrix, dtype, device, requires_grad, backend_name)
extrinsics = CameraExtrinsics(backend)
extrinsics._shared_fields['user_requested_backend'] = backend is not None
extrinsics._shared_fields['user_requested_backend'] = backend_name is not None
return extrinsics

def change_coordinate_system(self, basis_change: Union[np.array, torch.Tensor]):
Expand Down

0 comments on commit 5a07a55

Please sign in to comment.