Fix gradient scale in WeightedMSECriterion
This commit is contained in:
parent
4c691b4640
commit
9d63ed2947
|
@ -19,6 +19,7 @@ function WeightedMSECriterion:updateOutput(input, target)
|
|||
end
|
||||
|
||||
function WeightedMSECriterion:updateGradInput(input, target)
|
||||
self.gradInput:resizeAs(input):copy(self.diff)
|
||||
local norm = 2.0 / input:nElement()
|
||||
self.gradInput:resizeAs(input):copy(self.diff):mul(norm)
|
||||
return self.gradInput
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue