Skip to main content

ClikaRT::ops::hardshrink

function

hardshrink()

Tensor hardshrink(Tensor x, double lambd = 0.5)

Hard shrinkage: zeroes every element within [-lambd, lambd].

hardshrink(x)={xx>λ0otherwise\mathrm{hardshrink}(x) = \begin{cases} x & |x| > \lambda \\ 0 & \text{otherwise} \end{cases}

Parameters

  • x: the input tensor.
  • lambd: the shrink threshold (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::hardshrink(x, 0.1);

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