mlx_rs::nn

Function step

Source
pub fn step(
    x: impl AsRef<Array>,
    threshold: impl Into<Option<f32>>,
) -> Result<Array>
Expand description

Applies the Step Activation Function.

This function implements a binary step activation, where the output is set to 1 if the input is greater than a specified threshold, and 0 otherwise.

This is:

r#where(x.gt(threshold), 1, 0)