Skip to main content

ClikaRT::ops::softshrink

function

softshrink()

Tensor softshrink(Tensor x, double lambd = 0.5)

Soft thresholding: shrinks every element toward zero by lambd.

softshrink(x)=sign(x)max(xλ,  0)\mathrm{softshrink}(x) = \mathrm{sign}(x)\cdot\max(|x| - \lambda,\; 0)

Parameters

  • x: the input tensor.
  • lambd: the shrink amount (lambda). Default 0.5.

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::softshrink(x, 0.1);

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