From 0d3d8f4afdc38726b8ed933dbfcb85e759145c43 Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 2 Jun 2015 12:51:18 +0800 Subject: add preprocessing layers and change layer constructor interface --- layer/window.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 layer/window.lua (limited to 'layer/window.lua') 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 -- cgit v1.2.3