a15b3ec9a18377bf67356a9b5c29f4b767001d05,layers/losses.py,L1LossMasked,forward,#L1LossMasked#Any#Any#Any#,11
Before Change
// mask: (batch, max_len, 1)
mask = sequence_mask(
sequence_length=length, max_len=target.size(1)).unsqueeze(2)
losses = losses * mask.float()
loss = losses.sum() / (length.float().sum() * float(target.shape[2]))
return loss
class MSELossMasked(nn.Module):
After Change
mask = mask.expand_as(input)
loss = functional.l1_loss(
input * mask, target * mask, reduction="sum")
loss = loss / mask.sum()
return loss
class MSELossMasked(nn.Module):
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 9
Instances Project Name: mozilla/TTS
Commit Name: a15b3ec9a18377bf67356a9b5c29f4b767001d05
Time: 2018-08-13
Author: erengolge@gmail.com
File Name: layers/losses.py
Class Name: L1LossMasked
Method Name: forward
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: Coder-Yu/RecQ
Commit Name: 06e423b08766d831d903cf4422d2c46735dd7821
Time: 2017-06-09
Author: yuyu2223@163.com
File Name: data/rating.py
Class Name: RatingDAO
Method Name: __computeItemMean
Project Name: Coder-Yu/RecQ
Commit Name: 06e423b08766d831d903cf4422d2c46735dd7821
Time: 2017-06-09
Author: yuyu2223@163.com
File Name: data/rating.py
Class Name: RatingDAO
Method Name: __computeUserMean