fairseq/modules/multihead_attention.py

Killed 0 out of 5 mutants

Survived

Survived mutation testing. These mutants show holes in your test suite.

Mutant 689

--- fairseq/modules/multihead_attention.py
+++ fairseq/modules/multihead_attention.py
@@ -16,8 +16,6 @@
 from fairseq.modules.fairseq_dropout import FairseqDropout
 from fairseq.modules.quant_noise import quant_noise
 
-
-@with_incremental_state
 class MultiheadAttention(nn.Module):
     """Multi-headed attention.
 

Mutant 690

--- fairseq/modules/multihead_attention.py
+++ fairseq/modules/multihead_attention.py
@@ -37,7 +37,7 @@
         self_attention=False,
         encoder_decoder_attention=False,
         q_noise=0.0,
-        qn_block_size=8,
+        qn_block_size=9,
     ):
         super().__init__()
         self.embed_dim = embed_dim

Mutant 691

--- fairseq/modules/multihead_attention.py
+++ fairseq/modules/multihead_attention.py
@@ -119,7 +119,7 @@
         static_kv: bool = False,
         attn_mask: Optional[Tensor] = None,
         before_softmax: bool = False,
-        need_head_weights: bool = False,
+        need_head_weights: bool = True,
     ) -> Tuple[Tensor, Optional[Tensor]]:
         """Input shape: Time x Batch x Channel
 

Mutant 692

--- fairseq/modules/multihead_attention.py
+++ fairseq/modules/multihead_attention.py
@@ -371,7 +371,6 @@
 
         return attn, attn_weights
 
-    @staticmethod
     def _append_prev_key_padding_mask(
         key_padding_mask: Optional[Tensor],
         prev_key_padding_mask: Optional[Tensor],

Mutant 693

--- fairseq/modules/multihead_attention.py
+++ fairseq/modules/multihead_attention.py
@@ -409,7 +409,6 @@
             new_key_padding_mask = prev_key_padding_mask
         return new_key_padding_mask
 
-    @torch.jit.export
     def reorder_incremental_state(
         self, incremental_state: Dict[str, Dict[str, Optional[Tensor]]], new_order: Tensor
     ):