r""" SiLU activation function with input upcasted to torch.float32.
| 51 | |
| 52 | |
| 53 | class FP32SiLU(nn.Module): |
| 54 | r""" |
| 55 | SiLU activation function with input upcasted to torch.float32. |
| 56 | """ |
| 57 | |
| 58 | def __init__(self): |
| 59 | super().__init__() |
| 60 | |
| 61 | def forward(self, inputs: torch.Tensor) -> torch.Tensor: |
| 62 | return F.silu(inputs.float(), inplace=False).to(inputs.dtype) |
| 63 | |
| 64 | |
| 65 | class GELU(nn.Module): |