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

Rectified Linear Unit (ReLU). max(0, t)

The derivative is the Heaviside function.

Examples:

let t = tensor([-1.0, 0.0, 1.0, 2.0]);

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

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