Skip to main content

ClikaRT::ops::softplus

function

softplus()

Tensor softplus(
    Tensor x,
    double beta = 1.0,
    double threshold = 20.0
)

Smooth ReLU.

softplus(x)=1βlog ⁣(1+eβx)\mathrm{softplus}(x) = \tfrac{1}{\beta}\,\log\!\bigl(1 + e^{\beta x}\bigr)

For numerical stability the exact linear x is returned where beta * x > threshold.

Parameters

  • x: the input tensor.
  • beta: the sharpness; larger approaches ReLU. Default 1.0.
  • threshold: the linear-fallback switch point on beta * x. Default 20.0.

Throws

  • ClikaRT::Error: when the input's dtype is not served for this operation (the machine-readable reason rides code_name()).

Returns: a new tensor, same shape and dtype as x.

auto y = ClikaRT::ops::softplus(x);

Declared in ClikaRT/compute/ops.h, line 1088