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)
        encStates = self.model.init_decoder_state(context, encStates)

        useMasking = (self._type == "text")
        //  This mask is applied to the attention model inside the decoder
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

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: deepmipt/DeepPavlov
Commit Name: e258ef3ea167b86d6680bfcc513dd207586b90f4
Time: 2018-07-03
Author: yoptar@gmail.com
File Name: setup.py
Class Name:
Method Name: read_requirements


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