Skip to content

Commit

Permalink
fix bug with to_tensor
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneT2000 committed Jan 21, 2024
1 parent 67b17ab commit 460a8e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mani_skill2/utils/sapien_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ def to_tensor(array: Union[torch.Tensor, np.array, Sequence]):
return torch.Tensor(array).cuda()
elif get_backend_name() == "numpy":
if isinstance(array, np.ndarray):
return torch.from_numpy(array)
return array
elif isinstance(array, torch.Tensor):
return array.cpu().numpy()
else:
return torch.tensor(array)
return np.array(array)


def to_numpy(array: Union[Array, Sequence]):
Expand Down

0 comments on commit 460a8e5

Please sign in to comment.