parlai/agents/seq2seq/modules.py
Killed 14 out of 95 mutantsSurvived
Survived mutation testing. These mutants show holes in your test suite.Mutant 2
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -51,7 +51,7 @@
'attention',
'attention_length',
'attention_time',
- 'input_dropout',
+ 'XXinput_dropoutXX',
]:
if k in opt:
kwargs[k] = opt[k]
Mutant 3
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -53,7 +53,7 @@
'attention_time',
'input_dropout',
]:
- if k in opt:
+ if k not in opt:
kwargs[k] = opt[k]
return kwargs
Mutant 5
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -63,7 +63,7 @@
Sequence to sequence parent module.
"""
- RNN_OPTS = {'rnn': nn.RNN, 'gru': nn.GRU, 'lstm': nn.LSTM}
+ RNN_OPTS = {'XXrnnXX': nn.RNN, 'gru': nn.GRU, 'lstm': nn.LSTM}
def __init__(
self,
Mutant 7
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -63,7 +63,7 @@
Sequence to sequence parent module.
"""
- RNN_OPTS = {'rnn': nn.RNN, 'gru': nn.GRU, 'lstm': nn.LSTM}
+ RNN_OPTS = {'rnn': nn.RNN, 'gru': nn.GRU, 'XXlstmXX': nn.LSTM}
def __init__(
self,
Mutant 9
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -85,7 +85,7 @@
end_idx=2,
unknown_idx=3,
input_dropout=0,
- longest_label=1,
+ longest_label=2,
):
"""
Initialize seq2seq model.
Mutant 10
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -100,7 +100,7 @@
input_dropout=input_dropout,
longest_label=longest_label,
)
- self.attn_type = attention
+ self.attn_type = None
rnn_class = Seq2seq.RNN_OPTS[rnn_class]
self.decoder = RNNDecoder(
Mutant 12
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -119,7 +119,7 @@
shared_lt = (
self.decoder.lt # share embeddings between rnns
- if lookuptable in ('enc_dec', 'all')
+ if lookuptable not in ('enc_dec', 'all')
else None
)
shared_rnn = self.decoder.rnn if decoder == 'shared' else None
Mutant 13
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -119,7 +119,7 @@
shared_lt = (
self.decoder.lt # share embeddings between rnns
- if lookuptable in ('enc_dec', 'all')
+ if lookuptable in ('XXenc_decXX', 'all')
else None
)
shared_rnn = self.decoder.rnn if decoder == 'shared' else None
Mutant 14
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -119,7 +119,7 @@
shared_lt = (
self.decoder.lt # share embeddings between rnns
- if lookuptable in ('enc_dec', 'all')
+ if lookuptable in ('enc_dec', 'XXallXX')
else None
)
shared_rnn = self.decoder.rnn if decoder == 'shared' else None
Mutant 15
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -122,7 +122,7 @@
if lookuptable in ('enc_dec', 'all')
else None
)
- shared_rnn = self.decoder.rnn if decoder == 'shared' else None
+ shared_rnn = self.decoder.rnn if decoder != 'shared' else None
self.encoder = RNNEncoder(
num_features,
embeddingsize,
Mutant 16
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -122,7 +122,7 @@
if lookuptable in ('enc_dec', 'all')
else None
)
- shared_rnn = self.decoder.rnn if decoder == 'shared' else None
+ shared_rnn = self.decoder.rnn if decoder == 'XXsharedXX' else None
self.encoder = RNNEncoder(
num_features,
embeddingsize,
Mutant 17
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -122,7 +122,7 @@
if lookuptable in ('enc_dec', 'all')
else None
)
- shared_rnn = self.decoder.rnn if decoder == 'shared' else None
+ shared_rnn = None
self.encoder = RNNEncoder(
num_features,
embeddingsize,
Mutant 18
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -140,7 +140,7 @@
shared_weight = (
self.decoder.lt # use embeddings for projection
- if lookuptable in ('dec_out', 'all')
+ if lookuptable not in ('dec_out', 'all')
else None
)
self.output = OutputLayer(
Mutant 19
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -140,7 +140,7 @@
shared_weight = (
self.decoder.lt # use embeddings for projection
- if lookuptable in ('dec_out', 'all')
+ if lookuptable in ('XXdec_outXX', 'all')
else None
)
self.output = OutputLayer(
Mutant 20
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -140,7 +140,7 @@
shared_weight = (
self.decoder.lt # use embeddings for projection
- if lookuptable in ('dec_out', 'all')
+ if lookuptable in ('dec_out', 'XXallXX')
else None
)
self.output = OutputLayer(
Mutant 21
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -216,7 +216,7 @@
at this rate.
"""
super().__init__()
- self.unknown_idx = unknown_idx
+ self.unknown_idx = None
self.prob = probability
def forward(self, input):
Mutant 23
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -248,7 +248,7 @@
shared_rnn=None,
input_dropout=0,
unknown_idx=None,
- sparse=False,
+ sparse=True,
):
"""
Initialize recurrent encoder.
Mutant 25
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -256,7 +256,7 @@
super().__init__()
self.dropout = nn.Dropout(p=dropout)
- self.layers = numlayers
+ self.layers = None
self.dirs = 2 if bidirectional else 1
self.hsz = hiddensize
Mutant 26
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -257,7 +257,7 @@
self.dropout = nn.Dropout(p=dropout)
self.layers = numlayers
- self.dirs = 2 if bidirectional else 1
+ self.dirs = 3 if bidirectional else 1
self.hsz = hiddensize
if input_dropout > 0 and unknown_idx is None:
Mutant 29
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -258,7 +258,7 @@
self.dropout = nn.Dropout(p=dropout)
self.layers = numlayers
self.dirs = 2 if bidirectional else 1
- self.hsz = hiddensize
+ self.hsz = None
if input_dropout > 0 and unknown_idx is None:
raise RuntimeError('input_dropout > 0 but unknown_idx not set')
Mutant 30
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -260,7 +260,7 @@
self.dirs = 2 if bidirectional else 1
self.hsz = hiddensize
- if input_dropout > 0 and unknown_idx is None:
+ if input_dropout >= 0 and unknown_idx is None:
raise RuntimeError('input_dropout > 0 but unknown_idx not set')
self.input_dropout = UnknownDropout(unknown_idx, input_dropout)
Mutant 31
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -260,7 +260,7 @@
self.dirs = 2 if bidirectional else 1
self.hsz = hiddensize
- if input_dropout > 0 and unknown_idx is None:
+ if input_dropout > 1 and unknown_idx is None:
raise RuntimeError('input_dropout > 0 but unknown_idx not set')
self.input_dropout = UnknownDropout(unknown_idx, input_dropout)
Mutant 32
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -260,7 +260,7 @@
self.dirs = 2 if bidirectional else 1
self.hsz = hiddensize
- if input_dropout > 0 and unknown_idx is None:
+ if input_dropout > 0 and unknown_idx is not None:
raise RuntimeError('input_dropout > 0 but unknown_idx not set')
self.input_dropout = UnknownDropout(unknown_idx, input_dropout)
Mutant 33
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -260,7 +260,7 @@
self.dirs = 2 if bidirectional else 1
self.hsz = hiddensize
- if input_dropout > 0 and unknown_idx is None:
+ if input_dropout > 0 or unknown_idx is None:
raise RuntimeError('input_dropout > 0 but unknown_idx not set')
self.input_dropout = UnknownDropout(unknown_idx, input_dropout)
Mutant 35
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -264,7 +264,7 @@
raise RuntimeError('input_dropout > 0 but unknown_idx not set')
self.input_dropout = UnknownDropout(unknown_idx, input_dropout)
- if shared_lt is None:
+ if shared_lt is not None:
self.lt = nn.Embedding(
num_features, embeddingsize, padding_idx=padding_idx, sparse=sparse
)
Mutant 38
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -276,7 +276,7 @@
embeddingsize,
hiddensize,
numlayers,
- dropout=dropout if numlayers > 1 else 0,
+ dropout=dropout if numlayers >= 1 else 0,
batch_first=True,
bidirectional=bidirectional,
)
Mutant 39
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -276,7 +276,7 @@
embeddingsize,
hiddensize,
numlayers,
- dropout=dropout if numlayers > 1 else 0,
+ dropout=dropout if numlayers > 2 else 0,
batch_first=True,
bidirectional=bidirectional,
)
Mutant 40
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -276,7 +276,7 @@
embeddingsize,
hiddensize,
numlayers,
- dropout=dropout if numlayers > 1 else 0,
+ dropout=dropout if numlayers > 1 else 1,
batch_first=True,
bidirectional=bidirectional,
)
Mutant 41
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -277,7 +277,7 @@
hiddensize,
numlayers,
dropout=dropout if numlayers > 1 else 0,
- batch_first=True,
+ batch_first=False,
bidirectional=bidirectional,
)
elif bidirectional:
Mutant 42
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -352,7 +352,7 @@
attn_type='none',
attn_time='pre',
attn_length=-1,
- sparse=False,
+ sparse=True,
):
"""
Initialize recurrent decoder.
Mutant 44
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -359,7 +359,7 @@
"""
super().__init__()
self.dropout = nn.Dropout(p=dropout)
- self.layers = numlayers
+ self.layers = None
self.hsz = hiddensize
self.esz = embeddingsize
Mutant 45
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -360,7 +360,7 @@
super().__init__()
self.dropout = nn.Dropout(p=dropout)
self.layers = numlayers
- self.hsz = hiddensize
+ self.hsz = None
self.esz = embeddingsize
self.lt = nn.Embedding(
Mutant 46
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -361,7 +361,7 @@
self.dropout = nn.Dropout(p=dropout)
self.layers = numlayers
self.hsz = hiddensize
- self.esz = embeddingsize
+ self.esz = None
self.lt = nn.Embedding(
num_features, embeddingsize, padding_idx=padding_idx, sparse=sparse
Mutant 47
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -370,7 +370,7 @@
embeddingsize,
hiddensize,
numlayers,
- dropout=dropout if numlayers > 1 else 0,
+ dropout=dropout if numlayers >= 1 else 0,
batch_first=True,
)
Mutant 48
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -370,7 +370,7 @@
embeddingsize,
hiddensize,
numlayers,
- dropout=dropout if numlayers > 1 else 0,
+ dropout=dropout if numlayers > 2 else 0,
batch_first=True,
)
Mutant 49
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -370,7 +370,7 @@
embeddingsize,
hiddensize,
numlayers,
- dropout=dropout if numlayers > 1 else 0,
+ dropout=dropout if numlayers > 1 else 1,
batch_first=True,
)
Mutant 51
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -374,7 +374,7 @@
batch_first=True,
)
- self.attn_type = attn_type
+ self.attn_type = None
self.attn_time = attn_time
self.attention = AttentionLayer(
attn_type=attn_type,
Mutant 52
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -375,7 +375,7 @@
)
self.attn_type = attn_type
- self.attn_time = attn_time
+ self.attn_time = None
self.attention = AttentionLayer(
attn_type=attn_type,
hiddensize=hiddensize,
Mutant 53
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -472,7 +472,7 @@
dropout=0,
numsoftmax=1,
shared_weight=None,
- padding_idx=-1,
+ padding_idx=+1,
):
"""
Initialize output layer.
Mutant 54
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -472,7 +472,7 @@
dropout=0,
numsoftmax=1,
shared_weight=None,
- padding_idx=-1,
+ padding_idx=-2,
):
"""
Initialize output layer.
Mutant 57
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -499,7 +499,7 @@
self.dropout = nn.Dropout(p=dropout)
self.padding_idx = padding_idx
- rng = 1.0 / math.sqrt(num_features)
+ rng = 2.0 / math.sqrt(num_features)
self.bias = Parameter(torch.Tensor(num_features).uniform_(-rng, rng))
# embedding to scores
Mutant 58
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -499,7 +499,7 @@
self.dropout = nn.Dropout(p=dropout)
self.padding_idx = padding_idx
- rng = 1.0 / math.sqrt(num_features)
+ rng = 1.0 * math.sqrt(num_features)
self.bias = Parameter(torch.Tensor(num_features).uniform_(-rng, rng))
# embedding to scores
Mutant 60
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -500,7 +500,7 @@
self.padding_idx = padding_idx
rng = 1.0 / math.sqrt(num_features)
- self.bias = Parameter(torch.Tensor(num_features).uniform_(-rng, rng))
+ self.bias = Parameter(torch.Tensor(num_features).uniform_(+rng, rng))
# embedding to scores
if shared_weight is None:
Mutant 61
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -500,7 +500,7 @@
self.padding_idx = padding_idx
rng = 1.0 / math.sqrt(num_features)
- self.bias = Parameter(torch.Tensor(num_features).uniform_(-rng, rng))
+ self.bias = None
# embedding to scores
if shared_weight is None:
Mutant 62
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -503,7 +503,7 @@
self.bias = Parameter(torch.Tensor(num_features).uniform_(-rng, rng))
# embedding to scores
- if shared_weight is None:
+ if shared_weight is not None:
# just a regular linear layer
self.shared = False
self.weight = Parameter(
Mutant 63
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -511,7 +511,7 @@
)
else:
# use shared weights and a bias layer instead
- self.shared = True
+ self.shared = False
self.weight = shared_weight.weight
self.numsoftmax = numsoftmax
Mutant 64
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -511,7 +511,7 @@
)
else:
# use shared weights and a bias layer instead
- self.shared = True
+ self.shared = None
self.weight = shared_weight.weight
self.numsoftmax = numsoftmax
Mutant 68
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -515,7 +515,7 @@
self.weight = shared_weight.weight
self.numsoftmax = numsoftmax
- if numsoftmax > 1:
+ if numsoftmax > 2:
self.esz = embeddingsize
self.softmax = nn.Softmax(dim=1)
self.prior = nn.Linear(hiddensize, numsoftmax, bias=False)
Mutant 69
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -523,7 +523,7 @@
self.activation = nn.Tanh()
else:
# rnn output to embedding
- if hiddensize != embeddingsize:
+ if hiddensize == embeddingsize:
# learn projection to correct dimensions
self.o2e = nn.Linear(hiddensize, embeddingsize, bias=True)
else:
Mutant 71
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -587,7 +587,7 @@
embeddingsize,
bidirectional=False,
attn_length=-1,
- attn_time='pre',
+ attn_time='XXpreXX',
):
"""
Initialize attention layer.
Mutant 74
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -595,7 +595,7 @@
super().__init__()
self.attention = attn_type
- if self.attention != 'none':
+ if self.attention != 'XXnoneXX':
hsz = hiddensize
hszXdirs = hsz * (2 if bidirectional else 1)
if attn_time == 'pre':
Mutant 77
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -597,7 +597,7 @@
if self.attention != 'none':
hsz = hiddensize
- hszXdirs = hsz * (2 if bidirectional else 1)
+ hszXdirs = hsz * (3 if bidirectional else 1)
if attn_time == 'pre':
# attention happens on the input embeddings
input_dim = embeddingsize
Mutant 80
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -598,7 +598,7 @@
if self.attention != 'none':
hsz = hiddensize
hszXdirs = hsz * (2 if bidirectional else 1)
- if attn_time == 'pre':
+ if attn_time != 'pre':
# attention happens on the input embeddings
input_dim = embeddingsize
elif attn_time == 'post':
Mutant 81
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -598,7 +598,7 @@
if self.attention != 'none':
hsz = hiddensize
hszXdirs = hsz * (2 if bidirectional else 1)
- if attn_time == 'pre':
+ if attn_time == 'XXpreXX':
# attention happens on the input embeddings
input_dim = embeddingsize
elif attn_time == 'post':
Mutant 86
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -608,7 +608,7 @@
raise RuntimeError('unsupported attention time')
# linear layer for combining applied attention weights with input
- self.attn_combine = nn.Linear(hszXdirs + input_dim, input_dim, bias=False)
+ self.attn_combine = nn.Linear(hszXdirs + input_dim, input_dim, bias=True)
if self.attention == 'local':
# local attention over fixed set of output states
Mutant 89
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -610,7 +610,7 @@
# linear layer for combining applied attention weights with input
self.attn_combine = nn.Linear(hszXdirs + input_dim, input_dim, bias=False)
- if self.attention == 'local':
+ if self.attention == 'XXlocalXX':
# local attention over fixed set of output states
if attn_length < 0:
raise RuntimeError('Set attention length to > 0.')
Mutant 94
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -623,7 +623,7 @@
self.attn_v = nn.Linear(hsz, 1, bias=False)
elif self.attention == 'general':
# equivalent to dot if attn is identity
- self.attn = nn.Linear(hsz, hszXdirs, bias=False)
+ self.attn = nn.Linear(hsz, hszXdirs, bias=True)
def forward(self, xes, hidden, attn_params):
"""
Suspicious
Mutants that made the test suite take longer, but otherwise seemed okMutant 22
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -217,7 +217,7 @@
"""
super().__init__()
self.unknown_idx = unknown_idx
- self.prob = probability
+ self.prob = None
def forward(self, input):
"""
Mutant 24
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -255,7 +255,7 @@
"""
super().__init__()
- self.dropout = nn.Dropout(p=dropout)
+ self.dropout = None
self.layers = numlayers
self.dirs = 2 if bidirectional else 1
self.hsz = hiddensize
Mutant 27
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -257,7 +257,7 @@
self.dropout = nn.Dropout(p=dropout)
self.layers = numlayers
- self.dirs = 2 if bidirectional else 1
+ self.dirs = 2 if bidirectional else 2
self.hsz = hiddensize
if input_dropout > 0 and unknown_idx is None:
Mutant 28
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -257,7 +257,7 @@
self.dropout = nn.Dropout(p=dropout)
self.layers = numlayers
- self.dirs = 2 if bidirectional else 1
+ self.dirs = None
self.hsz = hiddensize
if input_dropout > 0 and unknown_idx is None:
Mutant 34
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -262,7 +262,7 @@
if input_dropout > 0 and unknown_idx is None:
raise RuntimeError('input_dropout > 0 but unknown_idx not set')
- self.input_dropout = UnknownDropout(unknown_idx, input_dropout)
+ self.input_dropout = None
if shared_lt is None:
self.lt = nn.Embedding(
Mutant 36
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -269,7 +269,7 @@
num_features, embeddingsize, padding_idx=padding_idx, sparse=sparse
)
else:
- self.lt = shared_lt
+ self.lt = None
if shared_rnn is None:
self.rnn = rnn_class(
Mutant 37
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -271,7 +271,7 @@
else:
self.lt = shared_lt
- if shared_rnn is None:
+ if shared_rnn is not None:
self.rnn = rnn_class(
embeddingsize,
hiddensize,
Mutant 43
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -358,7 +358,7 @@
Initialize recurrent decoder.
"""
super().__init__()
- self.dropout = nn.Dropout(p=dropout)
+ self.dropout = None
self.layers = numlayers
self.hsz = hiddensize
self.esz = embeddingsize
Mutant 50
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -371,7 +371,7 @@
hiddensize,
numlayers,
dropout=dropout if numlayers > 1 else 0,
- batch_first=True,
+ batch_first=False,
)
self.attn_type = attn_type
Mutant 55
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -496,7 +496,7 @@
entering shared embedding matrices.
"""
super().__init__()
- self.dropout = nn.Dropout(p=dropout)
+ self.dropout = None
self.padding_idx = padding_idx
rng = 1.0 / math.sqrt(num_features)
Mutant 56
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -498,7 +498,7 @@
super().__init__()
self.dropout = nn.Dropout(p=dropout)
- self.padding_idx = padding_idx
+ self.padding_idx = None
rng = 1.0 / math.sqrt(num_features)
self.bias = Parameter(torch.Tensor(num_features).uniform_(-rng, rng))
Mutant 65
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -512,7 +512,7 @@
else:
# use shared weights and a bias layer instead
self.shared = True
- self.weight = shared_weight.weight
+ self.weight = None
self.numsoftmax = numsoftmax
if numsoftmax > 1:
Mutant 66
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -514,7 +514,7 @@
self.shared = True
self.weight = shared_weight.weight
- self.numsoftmax = numsoftmax
+ self.numsoftmax = None
if numsoftmax > 1:
self.esz = embeddingsize
self.softmax = nn.Softmax(dim=1)
Mutant 67
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -515,7 +515,7 @@
self.weight = shared_weight.weight
self.numsoftmax = numsoftmax
- if numsoftmax > 1:
+ if numsoftmax >= 1:
self.esz = embeddingsize
self.softmax = nn.Softmax(dim=1)
self.prior = nn.Linear(hiddensize, numsoftmax, bias=False)
Mutant 70
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -528,7 +528,7 @@
self.o2e = nn.Linear(hiddensize, embeddingsize, bias=True)
else:
# no need for any transformation here
- self.o2e = Identity()
+ self.o2e = None
def forward(self, input):
"""
Mutant 72
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -593,7 +593,7 @@
Initialize attention layer.
"""
super().__init__()
- self.attention = attn_type
+ self.attention = None
if self.attention != 'none':
hsz = hiddensize
Mutant 73
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -595,7 +595,7 @@
super().__init__()
self.attention = attn_type
- if self.attention != 'none':
+ if self.attention == 'none':
hsz = hiddensize
hszXdirs = hsz * (2 if bidirectional else 1)
if attn_time == 'pre':
Mutant 78
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -597,7 +597,7 @@
if self.attention != 'none':
hsz = hiddensize
- hszXdirs = hsz * (2 if bidirectional else 1)
+ hszXdirs = hsz * (2 if bidirectional else 2)
if attn_time == 'pre':
# attention happens on the input embeddings
input_dim = embeddingsize
Mutant 87
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -608,7 +608,7 @@
raise RuntimeError('unsupported attention time')
# linear layer for combining applied attention weights with input
- self.attn_combine = nn.Linear(hszXdirs + input_dim, input_dim, bias=False)
+ self.attn_combine = None
if self.attention == 'local':
# local attention over fixed set of output states
Mutant 88
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -610,7 +610,7 @@
# linear layer for combining applied attention weights with input
self.attn_combine = nn.Linear(hszXdirs + input_dim, input_dim, bias=False)
- if self.attention == 'local':
+ if self.attention != 'local':
# local attention over fixed set of output states
if attn_length < 0:
raise RuntimeError('Set attention length to > 0.')
Mutant 90
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -618,7 +618,7 @@
# combines input and previous hidden output layer
self.attn = nn.Linear(hsz + input_dim, attn_length, bias=False)
# combines attention weights with encoder outputs
- elif self.attention == 'concat':
+ elif self.attention != 'concat':
self.attn = nn.Linear(hsz + hszXdirs, hsz, bias=False)
self.attn_v = nn.Linear(hsz, 1, bias=False)
elif self.attention == 'general':
Mutant 92
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -621,7 +621,7 @@
elif self.attention == 'concat':
self.attn = nn.Linear(hsz + hszXdirs, hsz, bias=False)
self.attn_v = nn.Linear(hsz, 1, bias=False)
- elif self.attention == 'general':
+ elif self.attention != 'general':
# equivalent to dot if attn is identity
self.attn = nn.Linear(hsz, hszXdirs, bias=False)
Mutant 93
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -621,7 +621,7 @@
elif self.attention == 'concat':
self.attn = nn.Linear(hsz + hszXdirs, hsz, bias=False)
self.attn_v = nn.Linear(hsz, 1, bias=False)
- elif self.attention == 'general':
+ elif self.attention == 'XXgeneralXX':
# equivalent to dot if attn is identity
self.attn = nn.Linear(hsz, hszXdirs, bias=False)
Mutant 95
--- parlai/agents/seq2seq/modules.py
+++ parlai/agents/seq2seq/modules.py
@@ -623,7 +623,7 @@
self.attn_v = nn.Linear(hsz, 1, bias=False)
elif self.attention == 'general':
# equivalent to dot if attn is identity
- self.attn = nn.Linear(hsz, hszXdirs, bias=False)
+ self.attn = None
def forward(self, xes, hidden, attn_params):
"""