mappings#
- tensordict.nn.mappings(key: str) Callable#
Returns the function named by
key.All the functions except
"none"(the identity) map real numbers to non-negative numbers."relu"can return 0, the others return positive numbers.- Parameters:
key (str) – one of “softplus”, “exp”, “relu”, “expln”, “biased_softplus” or “none” (no mapping).
Note
If the key begins with
"biased_softplus", then it needs to take the following form:"biased_softplus_{bias}"wherebiascan be converted to a floating point number. Alternatively, the"biased_softplus_{bias}_{min_val}"syntax can be used. The function is thenbiased_softpluswith these arguments:softplus(x + inv_softplus(bias - min_val)) + min_val, which returnsbiasfor a zero input and is always greater thanmin_val.Note
Custom mappings can be added through
tensordict.nn.add_custom_mapping.- Returns:
a Callable