[BUG] A dataclass in "next" doesn't get copied over in step_mdp
#1919
Closed
Description
Describe the bug
A dataclass in "next" doesn't get copied over in step_mdp.
To Reproduce
import dataclasses
from tensordict.tensordict import TensorDict
import torch
from torchrl.envs import step_mdp
@dataclasses.dataclass
class Test:
a: int
dataclass = Test(1)
new_tensordict = step_mdp(
TensorDict(
{"next": {"state": torch.tensor([1.0]), "test": dataclass}}, batch_size=1
)
)
print(new_tensordict.keys())
>> _StringKeys({'state': tensor([1.])})
Expected behavior
"test" in the example should be copied over.
System info
Using version 0.3.0 for both tensordict and torchrl.
Checklist
- I have checked that there is no similar issue in the repo (required)
- I have read the documentation (required)
- I have provided a minimal working example to reproduce the bug (required)