Skip to content

Commit

Permalink
Module support H2D move (#1831)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvyufeng authored Nov 21, 2024
1 parent 6285685 commit 965d658
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mindnlp/core/nn/modules/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,10 @@ def __dir__(self):
return sorted(keys)

def cuda(self):
return self
return self._apply(lambda t: t.move_to('GPU'))

def npu(self):
return self._apply(lambda t: t.move_to('Ascend'))

def _load_from_state_dict(self, state_dict, prefix, local_metadata, strict,
missing_keys, unexpected_keys, error_msgs):
Expand Down

0 comments on commit 965d658

Please sign in to comment.