(self, x)
| 59 | self.weight = nn.Parameter(torch.ones(dim)) |
| 60 | |
| 61 | def forward(self, x): |
| 62 | x = x * torch.rsqrt(x.float().pow(2).mean(dim=-1, keepdim=True) + |
| 63 | self.eps) |
| 64 | if self.weight.dtype in [torch.float16, torch.bfloat16]: |
| 65 | x = x.type_as(self.weight) |
| 66 | return self.weight * x |
| 67 | |
| 68 | |
| 69 | class T5Attention(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected