(
self,
query,
content,
memory,
query_mask: Optional[Tensor] = None,
content_mask: Optional[Tensor] = None,
content_key_padding_mask: Optional[Tensor] = None,
update_content: bool = True,
)
| 101 | return tgt, sa_weights, ca_weights |
| 102 | |
| 103 | def forward( |
| 104 | self, |
| 105 | query, |
| 106 | content, |
| 107 | memory, |
| 108 | query_mask: Optional[Tensor] = None, |
| 109 | content_mask: Optional[Tensor] = None, |
| 110 | content_key_padding_mask: Optional[Tensor] = None, |
| 111 | update_content: bool = True, |
| 112 | ): |
| 113 | query_norm = self.norm_q(query) |
| 114 | content_norm = self.norm_c(content) |
| 115 | query = self.forward_stream(query, query_norm, content_norm, memory, |
| 116 | query_mask, content_key_padding_mask)[0] |
| 117 | if update_content: |
| 118 | content = self.forward_stream(content, content_norm, content_norm, |
| 119 | memory, content_mask, |
| 120 | content_key_padding_mask)[0] |
| 121 | return query, content |
| 122 | |
| 123 | |
| 124 | class Decoder(nn.Module): |
nothing calls this directly
no test coverage detected