adf9ebd629abc21e0969db2a1c29f389b5301c9d,layers/common_layers.py,GravesAttention,forward,#GravesAttention#Any#Any#Any#,129

Before Change



        c_t = torch.bmm(alpha_t.unsqueeze(1), inputs).squeeze(1)
        self.mu_tm1 = mu_t
        return c_t, mu_t, alpha_t


class Attention(nn.Module):

After Change


        // g_t = torch.softmax(g_t, dim=-1) + self.epsilon  // distribution weight
        // sig_t = torch.exp(b_t) + self.epsilon  // variance
        // mu_t = self.mu_prev + self.attention_alignment * torch.exp(k_t)  // mean
        sig_t = torch.pow(torch.nn.functional.softplus(b_t), 2)
        mu_t = self.mu_prev + torch.nn.functional.softplus(k_t)
        g_t = (torch.softmax(g_t, dim=-1) / sig_t) * self.COEF

        g_t = g_t.unsqueeze(2).expand(g_t.size(0),
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: mozilla/TTS
Commit Name: adf9ebd629abc21e0969db2a1c29f389b5301c9d
Time: 2019-11-12
Author: egolge@mozilla.com
File Name: layers/common_layers.py
Class Name: GravesAttention
Method Name: forward


Project Name: reinforceio/tensorforce
Commit Name: 9a6ddf241ca2563917d35ac3c3e14a1e264f550e
Time: 2017-08-13
Author: mi.schaarschmidt@gmail.com
File Name: tensorforce/core/distributions/beta.py
Class Name: Beta
Method Name: create_tf_operations


Project Name: pymc-devs/pymc3
Commit Name: 8df47901fbae1c93bcec58a9a658a6a3ad9f5d07
Time: 2017-09-02
Author: maxim.v.kochurov@gmail.com
File Name: pymc3/variational/flows.py
Class Name: PlanarFlow
Method Name: make_uw