Files
Gymnasium/docs/api/vector.md

76 lines
1.6 KiB
Markdown
Raw Normal View History

2022-09-13 20:27:34 +01:00
---
title: Vector
---
# Vector
## Gymnasium.vector.VectorEnv
2022-09-13 20:27:34 +01:00
```{eval-rst}
.. autoclass:: gymnasium.vector.VectorEnv
```
2022-09-13 20:27:34 +01:00
### Methods
2022-09-13 20:27:34 +01:00
```{eval-rst}
.. automethod:: gymnasium.vector.VectorEnv.reset
.. automethod:: gymnasium.vector.VectorEnv.step
.. automethod:: gymnasium.vector.VectorEnv.close
```
### Attributes
2022-09-13 20:27:34 +01:00
```{eval-rst}
.. attribute:: action_space
2022-09-13 20:27:34 +01:00
The (batched) action space. The input actions of `step` must be valid elements of `action_space`.::
>>> envs = gymnasium.vector.make("CartPole-v1", num_envs=3)
>>> envs.action_space
MultiDiscrete([2 2 2])
.. attribute:: observation_space
2022-09-13 20:27:34 +01:00
The (batched) observation space. The observations returned by `reset` and `step` are valid elements of `observation_space`.::
>>> envs = gymnasium.vector.make("CartPole-v1", num_envs=3)
>>> envs.observation_space
Box([[-4.8 ...]], [[4.8 ...]], (3, 4), float32)
.. attribute:: single_action_space
2022-09-13 20:27:34 +01:00
The action space of an environment copy.::
>>> envs = gymnasium.vector.make("CartPole-v1", num_envs=3)
>>> envs.single_action_space
Discrete(2)
.. attribute:: single_observation_space
2022-09-13 20:27:34 +01:00
The observation space of an environment copy.::
>>> envs = gymnasium.vector.make("CartPole-v1", num_envs=3)
>>> envs.single_observation_space
2022-09-13 20:27:34 +01:00
Box([-4.8 ...], [4.8 ...], (4,), float32)
```
2022-09-13 20:27:34 +01:00
## Making Vector Environments
2022-09-13 20:27:34 +01:00
```{eval-rst}
.. autofunction:: gymnasium.vector.make
```
2022-09-13 20:27:34 +01:00
## Async Vector Env
2022-09-13 20:27:34 +01:00
```{eval-rst}
.. autoclass:: gymnasium.vector.AsyncVectorEnv
2022-09-13 20:27:34 +01:00
```
## Sync Vector Env
2022-09-13 20:27:34 +01:00
```{eval-rst}
.. autoclass:: gymnasium.vector.SyncVectorEnv
2022-09-13 20:27:34 +01:00
```