(self, dim, eps=1e-6)
| 22 | class T5LayerNorm(nn.Module): |
| 23 | |
| 24 | def __init__(self, dim, eps=1e-6): |
| 25 | super(T5LayerNorm, self).__init__() |
| 26 | self.dim = dim |
| 27 | self.eps = eps |
| 28 | self.weight = nn.Parameter(torch.ones(dim)) |
| 29 | |
| 30 | def forward(self, x): |
| 31 | x = x * torch.rsqrt(x.float().pow(2).mean(dim=-1, keepdim=True) + |