Skip to content

Commit

Permalink
[Bug] Fix the always-in-cpu from_numpy in ti.ndarray (taichi-dev#3239)
Browse files Browse the repository at this point in the history
  • Loading branch information
strongoier authored Oct 21, 2021
1 parent fcd5a88 commit fdad691
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/taichi/lang/_ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ def from_numpy(self, arr):
)
if impl.current_cfg().ndarray_use_torch:
self.arr = torch.from_numpy(arr).to(self.arr.dtype)
if impl.current_cfg().arch == _ti_core.Arch.cuda:
self.arr = self.arr.cuda()
else:
if hasattr(arr, 'contiguous'):
arr = arr.contiguous()
Expand Down

0 comments on commit fdad691

Please sign in to comment.