aboutsummaryrefslogtreecommitdiff
path: root/nerv/examples/lmptb/lmptb/layer/select_linear.lua
diff options
context:
space:
mode:
Diffstat (limited to 'nerv/examples/lmptb/lmptb/layer/select_linear.lua')
-rw-r--r--nerv/examples/lmptb/lmptb/layer/select_linear.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/nerv/examples/lmptb/lmptb/layer/select_linear.lua b/nerv/examples/lmptb/lmptb/layer/select_linear.lua
index d4cff0b..672b7e2 100644
--- a/nerv/examples/lmptb/lmptb/layer/select_linear.lua
+++ b/nerv/examples/lmptb/lmptb/layer/select_linear.lua
@@ -36,7 +36,8 @@ function SL:update(bp_err, input, output)
--word_vec:add(word_vec, bp_err[1][i - 1], 1, - self.gconf.lrate / self.gconf.batch_size)
-- end
--end
- self.ltp.trans:update_select_rows(bp_err[1], input[1], - self.gconf.lrate / self.gconf.batch_size, 0)
+ self.ltp.trans:update_select_rows(bp_err[1], input[1]:trans(), - self.gconf.lrate / self.gconf.batch_size, 0)
+ self.ltp.trans:add(self.ltp.trans, self.ltp.trans, 1.0, - self.gconf.lrate * self.gconf.wcost / self.gconf.batch_size)
end
function SL:propagate(input, output)
@@ -47,7 +48,7 @@ function SL:propagate(input, output)
-- output[1][i]:fill(0)
-- end
--end
- output[1]:copy_rows_fromd_by_idx(self.ltp.trans, input[1])
+ output[1]:copy_rows_fromd_by_idx(self.ltp.trans, input[1]:trans())
end
function SL:back_propagate(bp_err, next_bp_err, input, output)