summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2016-04-28 17:45:21 +0800
committerDeterminant <[email protected]>2016-04-28 17:45:21 +0800
commit6051c37a2c55365a5834d5b4c11d973e2e4e1ad4 (patch)
treee9355f5f7ccab73b73e7eb896ee187a0953eef4a
parent19abbff464f6492b5c7a9b57f94c48f690b7d4d8 (diff)
back-propagate error to the second head of nerv.MSELayer
-rw-r--r--nerv/layer/mse.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/nerv/layer/mse.lua b/nerv/layer/mse.lua
index c1ea596..594eb0c 100644
--- a/nerv/layer/mse.lua
+++ b/nerv/layer/mse.lua
@@ -63,9 +63,12 @@ function MSELayer:back_propagate(bp_err, next_bp_err, input, output, t)
t = 1
end
local nbe = next_bp_err[1]
+ local nbe2 = next_bp_err[2]
nbe:add(nbe, self.diff[t], 0.0, self.scale)
+ nbe2:add(nbe2, self.diff[t], 0.0, -self.scale)
if bp_err[1] ~= nil then
nbe:scale_rows_by_col(bp_err[1])
+ nbe2:scale_rows_by_col(bp_err[1])
end
end