(self,
x,
mask=None,
encoder_states=None,
encoder_mask=None,
pos_bias=None)
| 204 | num_buckets, num_heads, bidirectional=False) |
| 205 | |
| 206 | def forward(self, |
| 207 | x, |
| 208 | mask=None, |
| 209 | encoder_states=None, |
| 210 | encoder_mask=None, |
| 211 | pos_bias=None): |
| 212 | e = pos_bias if self.shared_pos else self.pos_embedding( |
| 213 | x.size(1), x.size(1)) |
| 214 | x = fp16_clamp(x + self.self_attn(self.norm1(x), mask=mask, pos_bias=e)) |
| 215 | x = fp16_clamp(x + self.cross_attn( |
| 216 | self.norm2(x), context=encoder_states, mask=encoder_mask)) |
| 217 | x = fp16_clamp(x + self.ffn(self.norm3(x))) |
| 218 | return x |
| 219 | |
| 220 | |
| 221 | class T5RelativeEmbedding(nn.Module): |
nothing calls this directly
no test coverage detected