aboutsummaryrefslogtreecommitdiff
path: root/layer/init.lua
diff options
context:
space:
mode:
authorcloudygoose <[email protected]>2015-06-03 10:29:41 +0800
committercloudygoose <[email protected]>2015-06-03 10:29:41 +0800
commitbf01fd6cea42def51becb6ea866d4fd335e45842 (patch)
tree09d12e50e3a6156c7e0cd7412b22fa4b61189495 /layer/init.lua
parent6984519cbb659aac0b0b323de93d5a90aa2049b7 (diff)
parentbb56a806e0636a0b20117b1644701d63e2bfaefb (diff)
...
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'layer/init.lua')
-rw-r--r--layer/init.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/layer/init.lua b/layer/init.lua
index a98621d..c8c691b 100644
--- a/layer/init.lua
+++ b/layer/init.lua
@@ -44,3 +44,26 @@ end
function nerv.Layer:back_propagate(next_bp_err, bp_err, input, output)
nerv.error_method_not_implemented()
end
+
+function nerv.Layer:check_dim_len(len_in, len_out)
+ local expected_in = #self.dim_in
+ local expected_out = #self.dim_out
+ if len_in > 0 and expected_in ~= len_in then
+ nerv.error("layer %s expects %d inputs, %d given",
+ self.id, len_in, expected_in)
+ end
+ if len_out > 0 and expected_out ~= len_out then
+ nerv.error("layer %s expects %d outputs, %d given",
+ self.id, len_out, expected_out)
+ end
+end
+
+function nerv.Layer:get_dim()
+ return self.dim_in, self.dim_out
+end
+
+require 'layer.affine'
+require 'layer.sigmoid'
+require 'layer.softmax_ce'
+require 'layer.bias'
+require 'layer.window'