Skip to content

Commit

Permalink
[BugFix] Use setdefault in _cache_values (#1910)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens authored Feb 15, 2024
1 parent 6c407bd commit 45764b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torchrl/objectives/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def _cache_values(fun):

def new_fun(self, netname=None):
__dict__ = self.__dict__
_cache = __dict__["_cache"]
_cache = __dict__.setdefault("_cache", {})
attr_name = name
if netname is not None:
attr_name += "_" + netname
Expand Down

0 comments on commit 45764b5

Please sign in to comment.