summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortxh18 <[email protected]>2015-11-17 23:31:14 +0800
committertxh18 <[email protected]>2015-11-17 23:31:14 +0800
commit54226ba490b65c223a230dc5de5cea56b1543594 (patch)
tree76709dfd982d1a89067d8464d8ec638d48b6bdf9
parentfc4c5a71053b837ed6143659a6e7b45792ed9e51 (diff)
bug fix for select_linear layer-by-layer update
-rw-r--r--nerv/examples/lmptb/lmptb/layer/select_linear.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/nerv/examples/lmptb/lmptb/layer/select_linear.lua b/nerv/examples/lmptb/lmptb/layer/select_linear.lua
index a0ae207..b215d48 100644
--- a/nerv/examples/lmptb/lmptb/layer/select_linear.lua
+++ b/nerv/examples/lmptb/lmptb/layer/select_linear.lua
@@ -30,8 +30,8 @@ function SL:init(batch_size)
end
function SL:update(bp_err, input, output)
- for i = 1, input[1]:ncol(), 1 do
- local word_vec = self.ltp.trans[input[1][0][i - 1]]
+ for i = 1, input[1]:nrow(), 1 do
+ local word_vec = self.ltp.trans[input[1][i - 1][0]]
word_vec:add(word_vec, bp_err[1][i - 1], 1, - self.gconf.lrate / self.gconf.batch_size)
end
--I tried the update_select_rows kernel which uses atomicAdd, but it generates unreproducable result