77a09f458cb762db906e8f8c9c87df42e280096d,onmt/Translator.py,,make_features,#Any#Any#,9
Before Change
def make_features(batch, fields):
// This is a bit hacky for now.
feats = []
for j in range(100):
key = "src_feat_" + str(j)
if key not in fields:
break
feats.append(batch.__dict__[key])
cat = [batch.src[0]] + feats
cat = [c.unsqueeze(2) for c in cat]
return torch.cat(cat, 2)
After Change
_, src_lengths = batch.src
src = onmt.IO.make_features(batch, self.fields)
// (1) run the encoder on the src
encStates, context = self.model.encoder(src, lengths=src_lengths)
en cStates = self.model.init_decoder_state(context, encStates)
useMasking = (self._type == "text")
// This mask is applied to the attention model inside the decoder
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances Project Name: OpenNMT/OpenNMT-py
Commit Name: 77a09f458cb762db906e8f8c9c87df42e280096d
Time: 2017-08-26
Author: srush@seas.harvard.edu
File Name: onmt/Translator.py
Class Name:
Method Name: make_features
Project Name: OpenNMT/OpenNMT-py
Commit Name: 32579822389423c7f4120e222aa26652f8507735
Time: 2018-12-18
Author: guillaumekln@users.noreply.github.com
File Name: onmt/utils/optimizers.py
Class Name: Optimizer
Method Name: set_parameters
Project Name: OpenNMT/OpenNMT-py
Commit Name: 13bbee615c87c812ddcfff73746cd504222e3fb0
Time: 2017-08-30
Author: nasa4836@gmail.com
File Name: onmt/Models.py
Class Name:
Method Name: make_base_model