Skip to content

Commit

Permalink
Add a comment regarding reference cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
egaznep committed Oct 24, 2024
1 parent 793f545 commit e8632b0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tensordict/_td.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,8 @@ def _cast_reduction(
agglomerate, keepdim=keepdim, dim=dim
)

# IMPORTANT: do not directly access batch_dims (or any other property)
# via self.batch_dims otherwise a reference cycle is introduced
def proc_dim(dim, batch_dims, tuple_ok=True):
if dim is None:
return dim
Expand Down

0 comments on commit e8632b0

Please sign in to comment.