Skip to content

Commit

Permalink
FIX asarray
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdoc committed Aug 24, 2024
1 parent 4c79287 commit 2e2ba68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion himalaya/backend/torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def asarray(x, dtype=None, device="cpu"):
tensor = torch.as_tensor(x, dtype=dtype, device=device)
except Exception:
import numpy as np
if x.device != "cpu":
if torch.is_tensor(x) and x.device != "cpu":
x = x.cpu()
array = np.asarray(x, dtype=_dtype_to_str(dtype))
tensor = torch.as_tensor(array, dtype=dtype, device=device)
Expand Down

0 comments on commit 2e2ba68

Please sign in to comment.