BaseStorage
BaseStorage(
observation_space: gym.Space, action_space: gym.Space, device: str,
storage_size: int, batch_size: int, num_envs: int
)
Base class of the storage module.
Args
- observation_space (gym.Space) : The observation space of environment.
- action_space (gym.Space) : The action space of environment.
- device (str) : Device (cpu, cuda, ...) on which the code should be run.
- storage_size (int) : The size of the storage.
- batch_size (int) : Batch size of samples.
- num_envs (int) : The number of parallel environments.
Returns
Instance of the base storage.
Methods:
.to_torch
Convert numpy array to torch tensor.
Args
- x (np.ndarray) : Numpy array.
Returns
Torch tensor.
.reset
Reset the storage.
.add
Add samples to the storage.
.sample
Sample from the storage.
.update
Update the storage if necessary.