f2ef1ca36afd4eb74bd1ad36a7a84411f69e5435,layers/attention.py,AttentionRNNCell,forward,#AttentionRNNCell#Any#Any#Any#Any#Any#Any#,108

Before Change


            mask = mask.view(memory.size(0), -1)
            alignment.masked_fill_(1 - mask, -float("inf"))
        // Normalize context weight
        alignment = F.softmax(alignment, dim=-1)
        // Attention context vector
        // (batch, 1, dim)
        // c_i = \sum_{j=1}^{T_x} \alpha_{ij} h_j
        context = torch.bmm(alignment.unsqueeze(1), annots)

After Change


            alignment.masked_fill_(1 - mask, -float("inf"))
        // Normalize context weight
        // alignment = F.softmax(alignment, dim=-1)
        alignment  = torch.sigmoid(alignment) / torch.sigmoid(alignment).sum(dim=1).unsqueeze(1)
        // Attention context vector
        // (batch, 1, dim)
        // c_i = \sum_{j=1}^{T_x} \alpha_{ij} h_j
        context = torch.bmm(alignment.unsqueeze(1), annots)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: mozilla/TTS
Commit Name: f2ef1ca36afd4eb74bd1ad36a7a84411f69e5435
Time: 2018-09-19
Author: erengolge@gmail.com
File Name: layers/attention.py
Class Name: AttentionRNNCell
Method Name: forward


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 627cb91321363a8bdc0920072e164ae465bae98f
Time: 2018-05-14
Author: M.N.Tran@ibm.com
File Name: art/classifiers/pytorch.py
Class Name: PyTorchClassifier
Method Name: predict


Project Name: mozilla/TTS
Commit Name: 4431e04b482238eee5d581eb2c9ca6789ac0ff12
Time: 2019-01-16
Author: egolge@mozilla.com
File Name: layers/attention.py
Class Name: AttentionRNNCell
Method Name: forward