torchact.nn.ReLU
- class torchact.nn.ReLU(inplace: bool = False)[source]
Implementation of Rectified Linear Unit.
\(\text{ReLU}(x) = \max(0, x)\)
- Parameters
inplace (bool) – In-place operation. Default: False
- Examples::
>>> import torch, torchact >>> m = torchact.nn.ReLU() >>> input = torch.tensor([1.0, -2.0, 0.0, 3.0]) >>> output = m(input) >>> print(output) tensor([1., 0., 0., 3.])