biased_softplus¶
- class torchrl.modules.utils.biased_softplus(bias: float, min_val: float = 0.01)[source]¶
A biased softplus module.
The bias indicates the value that is to be returned when a zero-tensor is passed through the transform.
- Parameters:
bias (scalar) – ‘bias’ of the softplus transform. If bias=1.0, then a _bias shift will be computed such that softplus(0.0 + _bias) = bias.
min_val (scalar) – minimum value of the transform. default: 0.1
- forward(x: Tensor) Tensor [source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.