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

Before Change


        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):
        if emb_file is not None:

After Change


        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: 3

Non-data size: 3

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: matplotlib/matplotlib
Commit Name: 9937d332ee11207ff2c01501cf3e1a8d5127fbb9
Time: 2019-12-02
Author: 2836374+timhoffm@users.noreply.github.com
File Name: examples/misc/zorder_demo.py
Class Name:
Method Name:


Project Name: utiasSTARS/liegroups
Commit Name: 071fb5fb20683946a33f40d28af466f8e9ffc1bd
Time: 2017-10-17
Author: clement.leopold@gmail.com
File Name: liegroups/torch/so2.py
Class Name: SO2
Method Name: left_jacobian