Skip to content

Commit

Permalink
[BugFix] Fix ellipsis check (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens authored Jan 3, 2024
1 parent 5b6573a commit 1b6b30c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tensordict/_td.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,10 @@ def __setitem__(
)
return

if index is Ellipsis or (isinstance(index, tuple) and Ellipsis in index):
# we must use any and because using Ellipsis in index can break with some indices
if index is Ellipsis or (
isinstance(index, tuple) and any(idx is Ellipsis for idx in index)
):
index = convert_ellipsis_to_idx(index, self.batch_size)

if isinstance(value, (TensorDictBase, dict)):
Expand Down

0 comments on commit 1b6b30c

Please sign in to comment.