ReLU6

Contents

ReLU6#

class brainstate.nn.ReLU6(*args, **kwargs)#

Applies the element-wise function.

ReLU6 is defined as:

\[\text{ReLU6}(x) = \min(\max(0,x), 6)\]

Shape#

  • Input: \((*)\), where \(*\) means any number of dimensions.

  • Output: \((*)\), same shape as the input.

Examples

>>> import brainstate.nn as nn
>>> import brainstate
>>> m = nn.ReLU6()
>>> x = brainstate.random.randn(2)
>>> output = m(x)