mappings¶
- class torchrl.modules.utils.mappings(key: str)[source]¶
Given an input string, returns a surjective function f(x): R -> R^+.
- Parameters:
key (str) – one of “softplus”, “exp”, “relu”, “expln”, or “biased_softplus”. If the key beggins with “biased_softplus”, then it needs to take the following form:
`"biased_softplus_{bias}"`
where`bias`
can be converted to a floating point number that will be used to bias the softplus function. Alternatively, the`"biased_softplus_{bias}_{min_val}"`
syntax can be used. In that case, the additional`min_val`
term is a floating point number that will be used to encode the minimum value of the softplus transform. In practice, the equation used is softplus(x + bias) + min_val, where bias and min_val are values computed such that the conditions above are met.- Returns:
a Callable