2022-09-13 20:27:34 +01:00
|
|
|
---
|
|
|
|
title: Vector
|
|
|
|
---
|
|
|
|
|
|
|
|
# Vector
|
|
|
|
|
2022-10-12 15:58:01 +01:00
|
|
|
## Gymnasium.vector.VectorEnv
|
|
|
|
|
2022-09-13 20:27:34 +01:00
|
|
|
```{eval-rst}
|
2022-10-12 15:58:01 +01:00
|
|
|
.. autoclass:: gymnasium.vector.VectorEnv
|
|
|
|
```
|
2022-09-13 20:27:34 +01:00
|
|
|
|
2022-10-12 15:58:01 +01:00
|
|
|
### Methods
|
2022-09-13 20:27:34 +01:00
|
|
|
|
2022-10-12 15:58:01 +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}
|
2022-10-12 15:58:01 +01:00
|
|
|
.. 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])
|
|
|
|
|
2022-10-12 15:58:01 +01:00
|
|
|
.. 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)
|
|
|
|
|
2022-10-12 15:58:01 +01:00
|
|
|
.. 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)
|
|
|
|
|
2022-10-12 15:58:01 +01:00
|
|
|
.. 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)
|
2023-05-08 11:42:35 +02:00
|
|
|
>>> envs.single_observation_space
|
2022-09-13 20:27:34 +01:00
|
|
|
Box([-4.8 ...], [4.8 ...], (4,), float32)
|
2022-10-12 15:58:01 +01:00
|
|
|
```
|
2022-09-13 20:27:34 +01:00
|
|
|
|
2022-10-12 15:58:01 +01:00
|
|
|
## Making Vector Environments
|
2022-09-13 20:27:34 +01:00
|
|
|
|
2022-10-12 15:58:01 +01:00
|
|
|
```{eval-rst}
|
|
|
|
.. autofunction:: gymnasium.vector.make
|
|
|
|
```
|
2022-09-13 20:27:34 +01:00
|
|
|
|
2022-10-12 15:58:01 +01:00
|
|
|
## Async Vector Env
|
2022-09-13 20:27:34 +01:00
|
|
|
|
|
|
|
```{eval-rst}
|
2022-10-12 15:58:01 +01:00
|
|
|
.. autoclass:: gymnasium.vector.AsyncVectorEnv
|
2022-09-13 20:27:34 +01:00
|
|
|
```
|
2022-10-12 15:58:01 +01:00
|
|
|
|
|
|
|
## Sync Vector Env
|
2022-09-13 20:27:34 +01:00
|
|
|
|
|
|
|
```{eval-rst}
|
2022-10-12 15:58:01 +01:00
|
|
|
.. autoclass:: gymnasium.vector.SyncVectorEnv
|
2022-09-13 20:27:34 +01:00
|
|
|
```
|