HabitatEnv¶
- torchrl.envs.HabitatEnv(*args, **kwargs)[source]¶
A wrapper for habitat envs.
This class currently serves as placeholder and compatibility security. It behaves exactly like the GymEnv wrapper.
Doc: https://aihabitat.org/docs/
GitHub: https://github.com/facebookresearch/habitat-lab
URL: https://aihabitat.org/habitat3/
Paper: https://ai.meta.com/static-resource/habitat3
- Parameters:
env_name (str) – The environment to execute.
categorical_action_encoding (bool, optional) – if
True
, categorical specs will be converted to the TorchRL equivalent (torchrl.data.DiscreteTensorSpec
), otherwise a one-hot encoding will be used (torchrl.data.OneHotTensorSpec
). Defaults toFalse
.
- Keyword Arguments:
from_pixels (bool, optional) – if
True
, an attempt to return the pixel observations from the env will be performed. By default, these observations will be written under the"pixels"
entry. The method being used varies depending on the gym version and may involve awrappers.pixel_observation.PixelObservationWrapper
. Defaults toFalse
.pixels_only (bool, optional) – if
True
, only the pixel observations will be returned (by default under the"pixels"
entry in the output tensordict). IfFalse
, observations (eg, states) and pixels will be returned wheneverfrom_pixels=True
. Defaults toTrue
.frame_skip (int, optional) – if provided, indicates for how many steps the same action is to be repeated. The observation returned will be the last observation of the sequence, whereas the reward will be the sum of rewards across steps.
device (torch.device, optional) – if provided, the device on which the simulation will occur. Defaults to
torch.device("cuda:0")
.batch_size (torch.Size, optional) – the batch size of the environment. Should match the leading dimensions of all observations, done states, rewards, actions and infos. Defaults to
torch.Size([])
.allow_done_after_reset (bool, optional) – if
True
, it is tolerated for envs to bedone
just afterreset()
is called. Defaults toFalse
.
- Variables:
available_envs (List[str]) – a list of environments to build.
Examples
>>> from torchrl.envs import HabitatEnv >>> env = HabitatEnv("HabitatRenderPick-v0", from_pixels=True) >>> env.rollout(3)