Skip to content

Commit

Permalink
FIX asarray
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdoc committed Feb 16, 2023
1 parent a30dbe8 commit 2d3dc49
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 2d3dc49

Please sign in to comment.