13bbee615c87c812ddcfff73746cd504222e3fb0,onmt/Models.py,,make_base_model,#Any#Any#Any#Any#Any#,561

Before Change



def make_base_model(opt, model_opt, fields, cuda, checkpoint=None):
    // HACK: collect source feature vocabs.
    feature_vocabs = []
    for j in range(100):
        key = "src_feat_" + str(j)
        if key not in fields:
            break
        feature_vocabs.append(fields[key].vocab)

    emb_opts = {"src_word_vec_size": model_opt.src_word_vec_size,
                "position_encoding": model_opt.position_encoding,
                "feat_merge": model_opt.feat_merge,
                "feat_vec_exponent": model_opt.feat_vec_exponent,

After Change


def make_base_model(opt, model_opt, fields, cuda, checkpoint=None):

    // Make Encoder.
    src_vocab = fields["src"].vocab
    num_feat_embeddings = [len(feat_dict) for feat_dict in
                           ONMTDataset.collect_feature_dicts(fields)]
    embeddings = build_embeddings(
                model_opt, src_vocab.stoi[onmt.IO.PAD_WORD],
                len(src_vocab), for_encoder=True,
                num_feat_embeddings=num_feat_embeddings)

    if model_opt.model_type == "text":
        encoder = Encoder(model_opt.encoder_type, model_opt.brnn,
                          model_opt.rnn_type, model_opt.enc_layers,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


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


Project Name: tensorflow/minigo
Commit Name: d9815bc9a70bf7362465c5839d082bd2af4b4771
Time: 2019-11-05
Author: tmadams@google.com
File Name: oneoffs/inspect_examples.py
Class Name:
Method Name: ReadExamples


Project Name: explosion/thinc
Commit Name: afc71e321e8e849d27e9d3b2f053c9ead11fd171
Time: 2017-02-04
Author: honnibal@gmail.com
File Name: thinc/neural/vecs2vec.py
Class Name: MeanPooling
Method Name: predict