core.noise#
The noise module provides sampler objects that generate random actions.
By providing a common interface for all noise samplers, algorithms can sample exploration actions independently of the noise type chosen.
- class soulsai.core.noise.Noise#
Abstract base class for noise sampling processes.
- forward(sample: TensorDict) torch.Tensor#
Alias for Noise.sample(sample).
- Parameters:
sample – The sample TensorDict the noise is sampled for.
- Returns:
The random action.
- abstract sample() int#
Generate a single noise sample.
- reset()#
Reset the noise process in case of stateful noise.
- class soulsai.core.noise.UniformDiscreteNoise(size_n: int)#
Discrete action noise sampler sampling uniformly over the interval of [0,
size_n).- sample(_: TensorDict) torch.Tensor#
Sample a random action in the range of [0,
size_n).- Returns:
The random action.
- reset()#
Reset the noise process in case of stateful noise.
- class soulsai.core.noise.MaskedDiscreteNoise(size_n: int, mask_key: NestedKey)#
Discrete action noise sampler omitting masked actions in the sample process.
Actions are uniformly sampled in the set of valid actions defined by the action mask.
- sample(sample: TensorDict) torch.Tensor#
Sample a random action in the range of [0,
size_n) while omitting masked actions.- Parameters:
sample – The sample TensorDict the noise is sampled for.
- Returns:
The random action.