diff options
author | cloudygoose <[email protected]> | 2015-06-03 10:29:41 +0800 |
---|---|---|
committer | cloudygoose <[email protected]> | 2015-06-03 10:29:41 +0800 |
commit | bf01fd6cea42def51becb6ea866d4fd335e45842 (patch) | |
tree | 09d12e50e3a6156c7e0cd7412b22fa4b61189495 /layer/sigmoid.lua | |
parent | 6984519cbb659aac0b0b323de93d5a90aa2049b7 (diff) | |
parent | bb56a806e0636a0b20117b1644701d63e2bfaefb (diff) |
...
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'layer/sigmoid.lua')
-rw-r--r-- | layer/sigmoid.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/layer/sigmoid.lua b/layer/sigmoid.lua index ca34419..220b7af 100644 --- a/layer/sigmoid.lua +++ b/layer/sigmoid.lua @@ -1,11 +1,17 @@ local SigmoidLayer = nerv.class("nerv.SigmoidLayer", "nerv.Layer") -function SigmoidLayer:__init(id, global_conf) +function SigmoidLayer:__init(id, global_conf, layer_conf) self.id = id self.gconf = global_conf + self.dim_in = layer_conf.dim_in + self.dim_out = layer_conf.dim_out + self:check_dim_len(1, 1) end function SigmoidLayer:init() + if self.dim_in[1] ~= self.dim_out[1] then + nerv.error("mismatching dimensions of input and output") + end end function SigmoidLayer:update(bp_err, input, output) @@ -13,9 +19,9 @@ function SigmoidLayer:update(bp_err, input, output) end function SigmoidLayer:propagate(input, output) - output[0]:sigmoid(input[0]) + output[1]:sigmoid(input[1]) end function SigmoidLayer:back_propagate(next_bp_err, bp_err, input, output) - next_bp_err[0]:sigmoid_grad(bp_err[0], output[0]) + next_bp_err[1]:sigmoid_grad(bp_err[1], output[1]) end |