Skip to content

Commit 70f5c06

Browse files
committed
[BugFix] Keep original class in LazyStackStorage through lazy_stack
ghstack-source-id: 661cd65 Pull Request resolved: #2873
1 parent 40fcdb6 commit 70f5c06

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

torchrl/data/replay_buffers/storages.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import torch
2020
from tensordict import (
2121
is_tensor_collection,
22+
lazy_stack,
2223
LazyStackedTensorDict,
2324
TensorDict,
2425
TensorDictBase,
@@ -430,7 +431,7 @@ def get(self, index: int | Sequence[int] | slice) -> Any:
430431
stack_dim = self.stack_dim
431432
if stack_dim < 0:
432433
stack_dim = out[0].ndim + 1 + stack_dim
433-
out = LazyStackedTensorDict(*out, stack_dim=stack_dim)
434+
out = lazy_stack(list(out), stack_dim=stack_dim)
434435
return out
435436
return out
436437

0 commit comments

Comments
 (0)