Closed L1aoXingyu closed 5 years ago
Describe the bug
I want to know if there is something wrong in mixup.py
mixup.py
def forward(self, output, target): if len(target.size()) == 2: loss1, loss2 = self.crit(output,target[:,0].long()), self.crit(output,target[:,1].long()) d = (loss1 * target[:,2] + loss2 * (1-target[:,2])).mean() else: d = self.crit(output, target) if self.reduction == 'mean': return d.mean() elif self.reduction == 'sum': return d.sum() return d
d should be loss1 lambd + loss2 (1-lambd) before reduction rather than (loss1 lambd + loss2 (1-lambd)).mean(). Is there something I misunderstanding?
Provide your installation details
To Reproduce
Expected behavior
Screenshots
Additional context
Yes it should! That's a good catch, could you suggest a PR with a fix since you found it?
Ok, I will suggest a PR tomorrow.
Fixed by your PR.
Describe the bug
I want to know if there is something wrong in
mixup.py
d should be loss1 lambd + loss2 (1-lambd) before reduction rather than (loss1 lambd + loss2 (1-lambd)).mean(). Is there something I misunderstanding?
Provide your installation details
To Reproduce
Expected behavior
Screenshots
Additional context