(self, x)
| 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) + |
| 32 | self.eps) |
| 33 | if self.weight.dtype in [torch.float16, torch.bfloat16]: |
| 34 | x = x.type_as(self.weight) |
| 35 | return self.weight * x |
| 36 | |
| 37 | |
| 38 | class T5Attention(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected