Added is_np_flattenable property to spaces docs (#172)

This commit is contained in:
Markus Krimmel
2022-12-02 17:01:42 +01:00
committed by GitHub
parent c6ee063f98
commit bd499eef25
4 changed files with 25 additions and 4 deletions

View File

@@ -46,4 +46,17 @@ In addition, new file and class require top docstrings that should outline the p
For classes, code block examples can be provided in the top docstring and not the constructor arguments.
To check your docstrings are correct, run `pre-commit run --all-files` or `pydocstyle --source --explain --convention=google`.
If all docstrings that fail, the source and reason for the failure is provided.
If all docstrings that fail, the source and reason for the failure is provided.
## Building the docs
Make sure that you have install the requirements:
```shell
cd docs
pip install -r requirements.txt
```
Then run
```
python scripts/gen_mds.py
make dirhtml
```
Now, navigate to `_build/dirhtml` and open `index.html` in your browser.

View File

@@ -13,20 +13,26 @@ spaces/utils
spaces/vector_utils
```
```{eval-rst}
.. automodule:: gymnasium.spaces
```
## The Base Class
```{eval-rst}
.. autoclass:: gymnasium.spaces.Space
```
## Attributes
### Attributes
```{eval-rst}
.. autoproperty:: gymnasium.spaces.space.Space.shape
.. property:: Space.dtype
Return the data type of this space.
.. autoproperty:: gymnasium.spaces.space.Space.is_np_flattenable
```
## Methods
### Methods
Each space implements the following functions:

View File

@@ -7,6 +7,8 @@ are vectors in the two-dimensional unit cube, the environment code may contain t
self.action_space = spaces.Discrete(3)
self.observation_space = spaces.Box(0, 1, shape=(2,))
All spaces inherit from the :class:`Space` superclass.
"""
from gymnasium.spaces.box import Box
from gymnasium.spaces.dict import Dict

View File

@@ -85,7 +85,7 @@ class Space(Generic[T_cov]):
@property
def is_np_flattenable(self) -> bool:
"""Checks whether this space can be flattened to a :class:`spaces.Box`."""
"""Checks whether this space can be flattened to a :class:`gymnasium.spaces.Box`."""
raise NotImplementedError
def sample(self, mask: Any | None = None) -> T_cov: