pub fn relu<T: Tensor<Dtype = f32>>(t: T) -> T
Expand description

Rectified Linear Unit (ReLU) computes max(0, x).

The derivative is the Heaviside function.

Examples:

let t = Tensor1D::new([-1.0, 0.0, 1.0, 2.0]);

// use function version
let r = relu(t.clone());

// or the tensor method!
let r2 = t.relu();