Skip to content

Commit

Permalink
[BugFix] Fix error for incongruent devices in load_state_dict (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens authored Sep 14, 2023
1 parent 0006b91 commit a721766
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tensordict/tensordict.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,11 +815,8 @@ def load_state_dict(
state_dict = copy(state_dict)
self.batch_size = state_dict.pop("__batch_size")
device = state_dict.pop("__device", None)
if device is not None:
if device != self.device:
raise RuntimeError(
"Loading data from another device is not yet supproted."
)
if device is not None and self.device is not None and device != self.device:
raise RuntimeError("Loading data from another device is not yet supported.")

for key, item in state_dict.items():
if isinstance(item, dict):
Expand Down

0 comments on commit a721766

Please sign in to comment.