nn.thresholded_relu
fn thresholded_relu(tensor: @Tensor<T>, alpha: @T) -> Tensor<T>Args
Returns
Type Constraints
Examples
use core::array::{ArrayTrait, SpanTrait};
use orion::operators::tensor::{TensorTrait, Tensor, FP8x23};
use orion::operators::nn::{NNTrait, FP8x23NN};
use orion::numbers::{FP8x23, FixedTrait};
fn thresholded_relu_example() -> Tensor<FP8x23> {
let tensor = TensorTrait::<FP8x23>::new(
shape: array![2, 2].span(),
data: array![
FixedTrait::new(0, false),
FixedTrait::new(256, false),
FixedTrait::new(512, false),
FixedTrait::new(257, false),
]
.span(),
);
let alpha = FixedTrait::from_felt(256); // 1.0
return NNTrait::leaky_relu(@tensor, @alpha);
}
>>> [[0, 0], [512, 257]]Last updated