summaryrefslogtreecommitdiff
path: root/layer
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-05-27 12:02:44 +0800
committerDeterminant <[email protected]>2015-05-27 12:02:44 +0800
commit44752a8175c54effd0c901333a7eb4cc71dd6810 (patch)
tree9794cfff9382e510298c729bb70b2cdd1ece23f7 /layer
parentf8543464c13584e39bfacee694ee1ed80ac121f4 (diff)
add implementation for sigmoid layer (not tested)
Diffstat (limited to 'layer')
-rw-r--r--layer/affine.lua1
-rw-r--r--layer/sigmoid.lua14
2 files changed, 15 insertions, 0 deletions
diff --git a/layer/affine.lua b/layer/affine.lua
index 221aacd..94e7497 100644
--- a/layer/affine.lua
+++ b/layer/affine.lua
@@ -11,6 +11,7 @@ function LinearTransParam:write(pfhandle)
end
function AffineLayer:__init(id, global_conf, ltp, bp)
+ self.id = id
self.ltp = ltp
self.bp = bp
self.gconf = global_conf
diff --git a/layer/sigmoid.lua b/layer/sigmoid.lua
new file mode 100644
index 0000000..d69e9e3
--- /dev/null
+++ b/layer/sigmoid.lua
@@ -0,0 +1,14 @@
+local SigmoidLayer = nerv.class("nerv.SigmoidLayer", "nerv.Layer")
+
+function SigmoidLayer:__init(id, global_conf)
+ self.id = id
+ self.gconf = global_conf
+end
+
+function SigmoidLayer:propagate(input, output)
+ output:sigmoid(input)
+end
+
+function SigmoidLayer:back_propagate(next_bp_err, bp_err, input, output)
+ next_bp_err:sigmoid(bp_err, output)
+end