mindspore.nn.probability.bijector.Softplus
- class mindspore.nn.probability.bijector.Softplus(sharpness=1.0, name='Softplus')[source]
- Softplus Bijector. This Bijector performs the operation: \[Y = \frac{\log(1 + e ^ {kX})}{k}\]- where \(k\) is the sharpness factor. - Parameters
 - Note - The dtype of sharpness must be float. - Raises
- TypeError – When the dtype of the sharpness is not float. 
 - Supported Platforms:
- Ascend- GPU- CPU
 - Examples - >>> import mindspore >>> import mindspore.nn as nn >>> import mindspore.nn.probability.bijector as msb >>> from mindspore import Tensor >>> >>> # To initialize a Softplus bijector of sharpness 2.0. >>> softplus = msb.Softplus(2.0) >>> # To use a Softplus bijector in a network. >>> value = Tensor([1, 2, 3], dtype=mindspore.float32) >>> ans1 = softplus.forward(value) >>> print(ans1.shape) (3,) >>> ans2 = softplus.inverse(value) >>> print(ans2.shape) (3,) >>> ans3 = softplus.forward_log_jacobian(value) >>> print(ans3.shape) (3,) >>> ans4 = softplus.inverse_log_jacobian(value) >>> print(ans4.shape) (3,) - property sharpness
- Return the sharpness parameter of the distribution. - Returns
- Tensor, the sharpness parameter of the distribution. 
 
 - forward(value)[source]
- forward mapping, compute the value after mapping. - Parameters
- value (Tensor) - the value to compute. 
 
- Returns
- Tensor, the value to compute. 
 
 - forward_log_jacobian(value)[source]
- compute the log value after mapping. - Parameters
- value (Tensor) - the value to compute. 
 
- Returns
- Tensor, the log value of forward mapping.