Skip to main content

threshold

Function threshold 

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

Applies the Threshold function element-wise, generalising thresholded_relu (which fixes value = 0): returns x where x > threshold, and value otherwise.

f(x) =

  • x if x > threshold
  • value otherwise

ยงArguments

  • threshold: the value to threshold at.
  • value: the value to replace with where x <= threshold.