aboutsummaryrefslogtreecommitdiff
path: root/nerv/layer/softmax_ce.lua
diff options
context:
space:
mode:
authortxh18 <[email protected]>2015-10-23 19:36:31 +0800
committertxh18 <[email protected]>2015-10-23 19:36:31 +0800
commit1234c026869ab052e898cc2541143fe4a22312b6 (patch)
treebd4b980ae12340b4ea3a8aa6259d43dc891b5568 /nerv/layer/softmax_ce.lua
parentf0937ae6e6401f25f15bb0e83e764ca888e81f11 (diff)
parent64fce92b7845b716f3c168036691c37b2467d99b (diff)
Just come back, let's merge the new master
Merge branch 'master' into txh18/rnnlm
Diffstat (limited to 'nerv/layer/softmax_ce.lua')
-rw-r--r--nerv/layer/softmax_ce.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/nerv/layer/softmax_ce.lua b/nerv/layer/softmax_ce.lua
index f878a2f..9071e86 100644
--- a/nerv/layer/softmax_ce.lua
+++ b/nerv/layer/softmax_ce.lua
@@ -23,6 +23,13 @@ function SoftmaxCELayer:init(batch_size)
self.ce = self.softmax:create()
end
+function SoftmaxCELayer:batch_resize(batch_size)
+ if self.softmax:nrow() ~= batch_resize then
+ self.softmax = self.gconf.cumat_type(batch_size, self.dim_in[1])
+ self.ce = self.softmax:create()
+ end
+end
+
function SoftmaxCELayer:update(bp_err, input, output)
-- no params, therefore do nothing
end