Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/test_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ def test_vmas_spec_rollout(
)
for e in [env, wrapped]:
e.set_seed(0)
check_env_specs(e, check_dtype=False)
check_env_specs(e)
del e

@pytest.mark.parametrize("num_envs", [1, 20])
Expand Down
4 changes: 3 additions & 1 deletion torchrl/envs/libs/vmas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import torch
from tensordict.tensordict import TensorDict, TensorDictBase

from torchrl.data import CompositeSpec, UnboundedContinuousTensorSpec
from torchrl.envs.common import _EnvWrapper
from torchrl.envs.libs.gym import _gym_to_torchrl_spec_transform
Expand Down Expand Up @@ -178,6 +179,7 @@ def _make_specs(
value, batch_size=torch.Size((self.num_envs,))
).shape[1:],
device=self.device,
dtype=torch.float32,
)
for key, value in self.scenario.info(agent0).items()
},
Expand Down Expand Up @@ -285,7 +287,7 @@ def read_info(self, infos: Dict[str, torch.Tensor]) -> torch.Tensor:
infos = TensorDict(
source={
key: _selective_unsqueeze(
value, batch_size=torch.Size((self.num_envs,))
value.to(torch.float32), batch_size=torch.Size((self.num_envs,))
)
for key, value in infos.items()
},
Expand Down