Skip to content

Commit c94d07f

Browse files
[Doc] Minor fixes to comments and docstrings (#2443)
1 parent a0dfddc commit c94d07f

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

sota-implementations/impala/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def make_ppo_modules_pixels(proof_environment):
100100
out_keys=["common_features"],
101101
)
102102

103-
# Define on head for the policy
103+
# Define one head for the policy
104104
policy_net = MLP(
105105
in_features=common_mlp_output.shape[-1],
106106
out_features=num_outputs,

torchrl/envs/common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,9 +2136,9 @@ def reset(
21362136
self._assert_tensordict_shape(tensordict)
21372137

21382138
tensordict_reset = self._reset(tensordict, **kwargs)
2139-
# We assume that this is done properly
2140-
# if reset.device != self.device:
2141-
# reset = reset.to(self.device, non_blocking=True)
2139+
# We assume that this is done properly
2140+
# if reset.device != self.device:
2141+
# reset = reset.to(self.device, non_blocking=True)
21422142
if tensordict_reset is tensordict:
21432143
raise RuntimeError(
21442144
"EnvBase._reset should return outplace changes to the input "

torchrl/envs/libs/gym.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ class GymEnv(GymWrapper):
12811281
pixels_only (bool, optional): if ``True``, only the pixel observations will
12821282
be returned (by default under the ``"pixels"`` entry in the output tensordict).
12831283
If ``False``, observations (eg, states) and pixels will be returned
1284-
whenever ``from_pixels=True``. Defaults to ``True``.
1284+
whenever ``from_pixels=True``. Defaults to ``False``.
12851285
frame_skip (int, optional): if provided, indicates for how many steps the
12861286
same action is to be repeated. The observation returned will be the
12871287
last observation of the sequence, whereas the reward will be the sum

torchrl/envs/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@
6969

7070

7171
ACTION_MASK_ERROR = RuntimeError(
72-
"An out-of-bounds actions has been provided to an env with an 'action_mask' output."
73-
" If you are using a custom policy, make sure to take the action mask into account when computing the output."
74-
" If you are using a default policy, please add the torchrl.envs.transforms.ActionMask transform to your environment."
72+
"An out-of-bounds actions has been provided to an env with an 'action_mask' output. "
73+
"If you are using a custom policy, make sure to take the action mask into account when computing the output. "
74+
"If you are using a default policy, please add the torchrl.envs.transforms.ActionMask transform to your environment. "
7575
"If you are using a ParallelEnv or another batched inventor, "
76-
"make sure to add the transform to the ParallelEnv (and not to the sub-environments)."
77-
" For more info on using action masks, see the docs at: "
78-
"https://pytorch.org/rl/reference/envs.html#environments-with-masked-actions"
76+
"make sure to add the transform to the ParallelEnv (and not to the sub-environments). "
77+
"For more info on using action masks, see the docs at: "
78+
"https://pytorch.org/rl/main/reference/envs.html#environments-with-masked-actions"
7979
)
8080

8181

torchrl/modules/distributions/continuous.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ class TanhNormal(FasterTransformedDistribution):
374374
.. math::
375375
loc = tanh(loc / upscale) * upscale.
376376
377-
min (torch.Tensor or number, optional): minimum value of the distribution. Default is -1.0;
378-
max (torch.Tensor or number, optional): maximum value of the distribution. Default is 1.0;
377+
low (torch.Tensor or number, optional): minimum value of the distribution. Default is -1.0;
378+
high (torch.Tensor or number, optional): maximum value of the distribution. Default is 1.0;
379379
event_dims (int, optional): number of dimensions describing the action.
380380
Default is 1. Setting ``event_dims`` to ``0`` will result in a log-probability that has the same shape
381381
as the input, ``1`` will reduce (sum over) the last dimension, ``2`` the last two etc.

torchrl/objectives/value/functional.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def _fast_vec_gae(
230230
``[*Batch x TimeSteps x F]``, with ``F`` feature dimensions.
231231
232232
"""
233-
# _gen_num_per_traj and _split_and_pad_sequence need
233+
# _get_num_per_traj and _split_and_pad_sequence need
234234
# time dimension at last position
235235
done = done.transpose(-2, -1)
236236
terminated = terminated.transpose(-2, -1)

tutorials/sphinx-tutorials/pendulum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
# * :meth:`EnvBase._reset`, which codes for the resetting of the simulator
129129
# at a (potentially random) initial state;
130130
# * :meth:`EnvBase._step` which codes for the state transition dynamic;
131-
# * :meth:`EnvBase._set_seed`` which implements the seeding mechanism;
131+
# * :meth:`EnvBase._set_seed` which implements the seeding mechanism;
132132
# * the environment specs.
133133
#
134134
# Let us first describe the problem at hand: we would like to model a simple

tutorials/sphinx-tutorials/torchrl_envs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ def env_make(env_name):
608608
###############################################################################
609609
# Transforming parallel environments
610610
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
611-
# There are two equivalent ways of transforming parallen environments: in each
611+
# There are two equivalent ways of transforming parallel environments: in each
612612
# process separately, or on the main process. It is even possible to do both.
613613
# One can therefore think carefully about the transform design to leverage the
614614
# device capabilities (e.g. transforms on cuda devices) and vectorizing

0 commit comments

Comments
 (0)