(self)
| 90 | |
| 91 | class SELU(nn.Module): |
| 92 | def __init__(self): |
| 93 | super().__init__() |
| 94 | self.alpha = 1.6732632423543772848170429916717 |
| 95 | self.scale = 1.0507009873554804934193349852946 |
| 96 | |
| 97 | def forward(self, x): |
| 98 | return self.scale * torch.where(x > 0, x, self.alpha * (torch.exp(x) - 1)) |