(self, x, context=None, additional_tokens=None, n_times_crossframe_attn_in_self=0)
| 417 | return checkpoint(self._forward, (x, context), self.parameters(), self.checkpoint) |
| 418 | |
| 419 | def _forward(self, x, context=None, additional_tokens=None, n_times_crossframe_attn_in_self=0): |
| 420 | x = ( |
| 421 | self.attn1( |
| 422 | self.norm1(x), |
| 423 | context=context if self.disable_self_attn else None, |
| 424 | additional_tokens=additional_tokens, |
| 425 | n_times_crossframe_attn_in_self=n_times_crossframe_attn_in_self if not self.disable_self_attn else 0, |
| 426 | ) |
| 427 | + x |
| 428 | ) |
| 429 | x = self.attn2(self.norm2(x), context=context, additional_tokens=additional_tokens) + x |
| 430 | x = self.ff(self.norm3(x)) + x |
| 431 | return x |
| 432 | |
| 433 | |
| 434 | class BasicTransformerSingleLayerBlock(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected