Skip to main content

softplus

Function softplus 

pub fn softplus<const D: usize>(tensor: Tensor<D>, beta: f64) -> Tensor<D>
Expand description

Applies the SoftPlus function element-wise.

softplus(x_i) = log(1 + exp(beta * x_i)) / beta

The SoftPlus function is a smooth approximation of the ReLU function.

Uses a default threshold of 20.0 for numerical stability. Use softplus_with_threshold to pick a different threshold.

ยงArguments

  • beta: Controls the sharpness of the approximation to ReLU.