rrelu

Contents

rrelu#

class brainstate.nn.rrelu(x, lower=0.125, upper=0.3333333333333333)[source]#

Randomized Leaky Rectified Linear Unit activation function.

The function is defined as:

\[\begin{split}\text{RReLU}(x) = \begin{cases} x & \text{if } x \geq 0 \\ ax & \text{ otherwise } \end{cases}\end{split}\]

where \(a\) is randomly sampled from uniform distribution \(\mathcal{U}(\text{lower}, \text{upper})\).

Parameters:
  • x (ArrayLike) – Input array of any shape.

  • lower (float, optional) – Lower bound of the uniform distribution for sampling the negative slope. Default is 1/8.

  • upper (float, optional) – Upper bound of the uniform distribution for sampling the negative slope. Default is 1/3.

Returns:

Output array with the same shape as the input.

Return type:

jax.Array or Quantity

References