(self, tgt: Tensor, memory: Tensor, tgt_mask: Optional[Tensor] = None,
memory_mask: Optional[Tensor] = None,
tgt_key_padding_mask: Optional[Tensor] = None,
memory_key_padding_mask: Optional[Tensor] = None)
| 59 | super(TransformerDecoderLayerOptimal, self).__setstate__(state) |
| 60 | |
| 61 | def forward(self, tgt: Tensor, memory: Tensor, tgt_mask: Optional[Tensor] = None, |
| 62 | memory_mask: Optional[Tensor] = None, |
| 63 | tgt_key_padding_mask: Optional[Tensor] = None, |
| 64 | memory_key_padding_mask: Optional[Tensor] = None) -> Tensor: |
| 65 | tgt = tgt + self.dropout1(tgt) |
| 66 | tgt = self.norm1(tgt) |
| 67 | tgt2 = self.multihead_attn(tgt, memory, memory)[0] |
| 68 | tgt = tgt + self.dropout2(tgt2) |
| 69 | tgt = self.norm2(tgt) |
| 70 | tgt2 = self.linear2(self.dropout(self.activation(self.linear1(tgt)))) |
| 71 | tgt = tgt + self.dropout3(tgt2) |
| 72 | tgt = self.norm3(tgt) |
| 73 | return tgt |
| 74 | |
| 75 | |
| 76 | # @torch.jit.script |
nothing calls this directly
no outgoing calls
no test coverage detected