Skip to content

Commit

Permalink
[BugFix] Fix deepcopy of TensorDictParams (#580)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens authored Nov 27, 2023
1 parent c730421 commit 1a9aca2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tensordict/nn/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,12 @@ def __ne__(self, other: object) -> TensorDictBase:
...

def __getattr__(self, item: str) -> Any:
try:
return getattr(self.__dict__["_param_td"], item)
except AttributeError:
if not item.startswith("_"):
try:
return getattr(self.__dict__["_param_td"], item)
except AttributeError:
return super().__getattr__(item)
else:
return super().__getattr__(item)

@_fallback
Expand Down

0 comments on commit 1a9aca2

Please sign in to comment.