2bbac5fa20b9b16fafd3e3948ed3fb92c79ef51c,transformer/Models.py,Decoder,__init__,#Decoder#,88

Before Change


            self, n_tgt_vocab, n_max_seq, n_layers=6, n_head=8, d_k=64, d_v=64,
            d_word_vec=512, d_model=512, d_inner_hid=1024, dropout=0.1):

        super(Decoder, self).__init__()
        n_position = n_max_seq + 1
        self.n_max_seq = n_max_seq
        self.d_model = d_model

After Change



        self.position_enc = nn.Embedding(
            n_position, d_word_vec, padding_idx=Constants.PAD)
        self.position_enc.weight = nn.Parameter(
            sinusoid_position_encoding_table(n_position, d_word_vec),
            requires_grad=False)

        self.tgt_word_emb = nn.Embedding(
            n_tgt_vocab, d_word_vec, padding_idx=Constants.PAD)
        self.dropout = nn.Dropout(dropout)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: jadore801120/attention-is-all-you-need-pytorch
Commit Name: 2bbac5fa20b9b16fafd3e3948ed3fb92c79ef51c
Time: 2018-08-21
Author: yhhuang@nlg.csie.ntu.edu.tw
File Name: transformer/Models.py
Class Name: Decoder
Method Name: __init__


Project Name: pytorch/tutorials
Commit Name: ce58d5904c04c4be10561447e41a153f573a3f93
Time: 2020-12-03
Author: qasdfgtyuiop@gmail.com
File Name: beginner_source/examples_nn/dynamic_net.py
Class Name: DynamicNet
Method Name: __init__


Project Name: jadore801120/attention-is-all-you-need-pytorch
Commit Name: 2bbac5fa20b9b16fafd3e3948ed3fb92c79ef51c
Time: 2018-08-21
Author: yhhuang@nlg.csie.ntu.edu.tw
File Name: transformer/Models.py
Class Name: Encoder
Method Name: __init__