pub fn prelu<const D: usize, B: Backend>(
tensor: Tensor<B, D>,
alpha: Tensor<B, 1>,
) -> Tensor<B, D>Available on crate feature
api only.Expand description
Applies Parametric ReLu activation function as described in the paper Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification.
- The tensor is assumed to be of shape
[batch_size, channels, ...]. alphais assumed to be of shape[channels]or[1].
$$ \text{PReLU}(x) = \max(0,x) + \alpha \cdot \min(0, x) $$
or
$$ \text{PReLU}(x) = \begin{cases} x & \text{if } x \geq 0 \newline \alpha x & \text{otherwise} \end{cases} $$