Skip to content

Commit

Permalink
Flatten space docstring note about unflattening samples (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
rusu24edward authored Nov 28, 2022
1 parent a175968 commit df811e7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gymnasium/spaces/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,11 @@ def flatten_space(space: Space[Any]) -> Box | Dict | Sequence | Tuple | Graph:
the result for graph spaces is always a `Graph` with `node_space` being a `Box`
with flat boundaries and `edge_space` being a `Box` with flat boundaries or
`None`. The box has exactly :func:`flatdim` dimensions. Flattening a sample
of the original space has the same effect as taking a sample of the flattenend
space.
of the original space has the same effect as taking a sample of the flattened
space. However, sampling from the flattened space is not necessarily reversible.
For example, sampling from a flattened Discrete space is the same as sampling from
a Box, and the results may not be integers or one-hot encodings. This may result in
errors or non-uniform sampling.
Example::
>>> from gymnasium.spaces import Box
Expand Down

0 comments on commit df811e7

Please sign in to comment.