SymLogValueTransform#
- class torchrl.modules.SymLogValueTransform(*args: Any, **kwargs: Any)[source]#
Symmetric-log value transform used by DreamerV3.
This transform applies
torchrl.modules.functional.symlog()in the forward direction andtorchrl.modules.functional.symexp()in the inverse direction.Examples
>>> import torch >>> from torchrl.modules import SymLogValueTransform >>> transform = SymLogValueTransform() >>> value = torch.tensor([-100.0, 0.0, 100.0]) >>> transformed = transform(value) >>> transformed tensor([-4.6151, 0.0000, 4.6151]) >>> transform.inverse(transformed) tensor([-100.0000, 0.0000, 100.0000])
See also
torchrl.modules.functional.symlog()andtorchrl.modules.functional.symexp()for the functional form, andSignedHyperbolicValueTransformfor an alternative nonlinear transform.Note
See Mastering Diverse Domains through World Models (Hafner et al., 2023).
- forward(value: Tensor) Tensor[source]#
Apply
torchrl.modules.functional.symlog()tovalue.
- inverse(value: Tensor) Tensor[source]#
Apply
torchrl.modules.functional.symexp()tovalue.