ba164c0dbb3d8171004380956a88431f4e8248ba,onmt/Models.py,Embeddings,make_positional_encodings,#Embeddings#Any#Any#,51

Before Change


        pe = torch.zeros(max_len, 1, dim)
        for i in range(dim):
            for j in range(max_len):
                k = float(j) / (10000.0 ** (2.0*i / float(dim)))
                pe[j, 0, i] = math.cos(k) if i % 2 == 1 else math.sin(k)
        return pe

    def load_pretrained_vectors(self, emb_file):

After Change


        pe = torch.arange(0, max_len).unsqueeze(1).expand(max_len, dim)
        div_term = 1 / torch.pow(10000, torch.arange(0, dim * 2, 2) / dim)
        pe = pe * div_term.expand_as(pe)
        pe[:, 0::2] = torch.sin(pe[:, 0::2])
        pe[:, 1::2] = torch.cos(pe[:, 1::2])
        return pe.unsqueeze(1)

    def load_pretrained_vectors(self, emb_file):
        if emb_file is not None:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: OpenNMT/OpenNMT-py
Commit Name: ba164c0dbb3d8171004380956a88431f4e8248ba
Time: 2017-08-01
Author: bpeters@coli.uni-saarland.de
File Name: onmt/Models.py
Class Name: Embeddings
Method Name: make_positional_encodings


Project Name: chainer/chainercv
Commit Name: 4a4e470321085513f38283c5aa2fd4460b80f58d
Time: 2017-03-15
Author: Hakuyume@users.noreply.github.com
File Name: chainercv/datasets/pascal_voc/voc_detection_dataset.py
Class Name: VOCDetectionDataset
Method Name: get_example


Project Name: dmlc/gluon-nlp
Commit Name: 70a188776f7470c838dd22b1636462b75573a734
Time: 2020-07-16
Author: lausen@amazon.com
File Name: src/gluonnlp/sequence_sampler.py
Class Name: BeamSearchScorer
Method Name: __init__


Project Name: ray-project/ray
Commit Name: 2298f6fb40cb6d348b5b48593c93cdd58ddd1f29
Time: 2020-04-23
Author: ekhliang@gmail.com
File Name: rllib/utils/exploration/per_worker_epsilon_greedy.py
Class Name: PerWorkerEpsilonGreedy
Method Name: __init__