Skip to content

Commit

Permalink
Do not wrap array in a torch tensor if already a tensor
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulero committed Jan 25, 2024
1 parent f308a52 commit 9095103
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/adam/pytorch/torch_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def __matmul__(self, other: Union["TorchLike", ntp.ArrayLike]) -> "TorchLike":

if type(self) is type(other):
return TorchLike(self.array @ other.array)
if isinstance(other, torch.Tensor):
return TorchLike(self.array @ other)
else:
return TorchLike(self.array @ torch.tensor(other))

Expand Down

0 comments on commit 9095103

Please sign in to comment.