Skip to content

Commit

Permalink
[BugFix] Fix index in list error (#627)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens authored Jan 17, 2024
1 parent e50f614 commit 4225911
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tensordict/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,8 @@ def format_size(size):
def _index_preserve_data_ptr(index):
if isinstance(index, tuple):
return all(_index_preserve_data_ptr(idx) for idx in index)
if index in (None, Ellipsis):
# we can't use a list comprehension here because it fails with tensor indices
if index is None or index is Ellipsis:
return True
if isinstance(index, int):
return True
Expand Down

0 comments on commit 4225911

Please sign in to comment.