4326582bb1e68480ef79a02abbf4bfacc3aadede,layers/losses.py,MSELossMasked,forward,#MSELossMasked#Any#Any#Any#,39

Before Change


        // target_flat: (batch * max_len, dim)
        target_flat = target.view(-1, target.shape[-1])
        // losses_flat: (batch * max_len, dim)
        losses_flat = functional.mse_loss(
            input, target_flat, size_average=False, reduce=False)
        // losses: (batch, max_len, dim)
        losses = losses_flat.view(*target.size())

        // mask: (batch, max_len, 1)

After Change


        mask = mask.expand_as(input)
        loss = functional.mse_loss(
            input * mask, target * mask, reduction="sum")
        loss = loss / mask.sum()
        return loss

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: mozilla/TTS
Commit Name: 4326582bb1e68480ef79a02abbf4bfacc3aadede
Time: 2019-03-06
Author: egolge@mozilla.com
File Name: layers/losses.py
Class Name: MSELossMasked
Method Name: forward


Project Name: leftthomas/SRGAN
Commit Name: df0c3ae7f9471f97e70e44e615eed9577fcf3f84
Time: 2017-11-19
Author: leftthomas@qq.com
File Name: train.py
Class Name:
Method Name:


Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: 8d52bd0b09152b02e0a5504d33593d0c290b88c7
Time: 2018-02-05
Author: max.lapan@gmail.com
File Name: ch14/06_train_d4pg.py
Class Name:
Method Name: