Skip to content

Commit

Permalink
[BugFix] Faster and safer non-tensor stack
Browse files Browse the repository at this point in the history
ghstack-source-id: f6c61cd14954a87a6de333eda2cd14e5f822a4e9
Pull Request resolved: #1232
  • Loading branch information
vmoens committed Feb 24, 2025
1 parent d25bd54 commit e23ce5c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tensordict/tensorclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -3227,6 +3227,8 @@ def _stack_non_tensor(cls, list_of_non_tensor, dim=0, raise_if_non_unique=False)
ids = set()
firstdata = NO_DEFAULT
return_stack = not capture_non_tensor_stack()
if return_stack:
return NonTensorStack(*list_of_non_tensor, stack_dim=dim)
for data in list_of_non_tensor:
if not isinstance(data, NonTensorData):
if raise_if_non_unique:
Expand Down

0 comments on commit e23ce5c

Please sign in to comment.