fn
rrelu
→Tensorrrelu(x: Tensor, lower: float = 1.0 / 8.0, upper: float = 1.0 / 3.0, training: bool = False, inplace: bool = False)Randomised leaky ReLU (Xu et al. 2015).
A regularised variant of leaky_relu: during training every
negative element is scaled by an i.i.d. uniform slope, injecting
activation noise on the negative side. At evaluation time the
expectation of that uniform draw is used, so the function becomes
deterministic.
Parameters
xTensorInput tensor.
lowerfloat= 1.0 / 8.0Lower bound of the uniform slope distribution. Default
1/8.upperfloat= 1.0 / 3.0Upper bound of the uniform slope distribution. Default
1/3.trainingbool= FalseIf
True sample a fresh slope per element; if False use the
midpoint. Default False.inplacebool= FalseAccepted for API compatibility; currently ignored.
Returns
TensorActivated tensor with the same shape as x.
Notes
During training, with sampled element-wise:
During evaluation, is replaced by the expectation . The slope randomisation acts as a mild noise regulariser — comparable in spirit to dropout but applied to activation slope rather than activation magnitude.
Examples
>>> import lucid
>>> from lucid.nn.functional import rrelu
>>> x = lucid.tensor([-1.0, 0.0, 1.0])
>>> rrelu(x, training=False)
Tensor([-0.2292, 0.0000, 1.0000])