Skip to main content

shrink

Function shrink 

pub fn shrink<const D: usize>(
    tensor: Tensor<D>,
    lambda: f64,
    bias: f64,
) -> Tensor<D>
Expand description

Applies the Shrink function element-wise.

shrink(x) = x - bias if x > lambda, x + bias if x < -lambda, 0 otherwise

ยงArguments

  • lambda: the lambda value for the Shrink formulation.
  • bias: the bias value for the Shrink formulation.