aboutsummaryrefslogtreecommitdiff
path: root/layer/window.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/window.lua
parent6984519cbb659aac0b0b323de93d5a90aa2049b7 (diff)
parentbb56a806e0636a0b20117b1644701d63e2bfaefb (diff)
...
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'layer/window.lua')
-rw-r--r--layer/window.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/layer/window.lua b/layer/window.lua
new file mode 100644
index 0000000..8e9e761
--- /dev/null
+++ b/layer/window.lua
@@ -0,0 +1,24 @@
+local WindowLayer = nerv.class("nerv.WindowLayer", "nerv.Layer")
+
+function WindowLayer:__init(id, global_conf, layer_conf)
+ self.id = id
+ self.gconf = global_conf
+ self.window = layer_conf.window
+ self.dim_in = layer_conf.dim_in
+ self.dim_out = layer_conf.dim_out
+ self:check_dim_len(1, 1)
+end
+
+function WindowLayer:init()
+ if self.dim_in[1] ~= self.window.trans:ncol() then
+ nerv.error("mismatching dimensions of input and window parameter")
+ end
+ if self.dim_out[1] ~= self.window.trans:ncol() then
+ nerv.error("mismatching dimensions of output and window parameter")
+ end
+end
+
+function WindowLayer:propagate(input, output)
+ output[1]:copy_fromd(input[1])
+ output[1]:scale_row(self.window.trans)
+end