Skip to main content

burn_ndarray/ops/
activation.rs

1use crate::{NdArray, execute_with_numeric_dtype, ops::NdArrayMathOps};
2use burn_backend::{ElementConversion, TensorMetadata, ops::ActivationOps, tensor::FloatTensor};
3
4impl ActivationOps<Self> for NdArray {
5    fn relu(tensor: FloatTensor<Self>) -> FloatTensor<Self> {
6        execute_with_numeric_dtype!(tensor, |array| NdArrayMathOps::clamp_min(array, 0.elem()))
7    }
8}