burn-ndarray 0.18.0

Ndarray backend for the Burn framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::{
    NdArray,
    element::{FloatNdArrayElement, IntNdArrayElement, QuantElement},
    execute_with_float_dtype,
    ops::NdArrayMathOps,
};
use burn_tensor::{
    ElementConversion,
    ops::{ActivationOps, FloatTensor},
};

impl<E: FloatNdArrayElement, I: IntNdArrayElement, Q: QuantElement> ActivationOps<Self>
    for NdArray<E, I, Q>
{
    fn relu(tensor: FloatTensor<Self>) -> FloatTensor<Self> {
        execute_with_float_dtype!(tensor, |tensor| NdArrayMathOps::clamp_min(tensor, 0.elem()))
    }
}