diff options
author | Qi Liu <[email protected]> | 2016-03-02 15:38:55 +0800 |
---|---|---|
committer | Qi Liu <[email protected]> | 2016-03-02 15:38:55 +0800 |
commit | a87f8954c97cf633a0100c9108764bca8c43a083 (patch) | |
tree | 88679743838a3c885551562dab0b1bab8cc0d10d /nerv/layer/identity.lua | |
parent | 31e575379fa46eb8f76f00ba62e11626ed67ca72 (diff) |
add identity layer
Diffstat (limited to 'nerv/layer/identity.lua')
-rw-r--r-- | nerv/layer/identity.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/nerv/layer/identity.lua b/nerv/layer/identity.lua new file mode 100644 index 0000000..dc796fb --- /dev/null +++ b/nerv/layer/identity.lua @@ -0,0 +1,33 @@ +local IdentityLayer = nerv.class('nerv.IdentityLayer', 'nerv.Layer') + +function IdentityLayer:__init(id, global_conf, layer_conf) + self.id = id + self.dim_in = layer_conf.dim_in + self.dim_out = layer_conf.dim_out + self.gconf = global_conf + self:check_dim_len(1, 1) + if self.dim_in[1] ~= self.dim_out[1] then + nerv.error('mismatching dimensions of input and output') + end +end + +function IdentityLayer:init() +end + +function IdentityLayer:batch_resize() +end + +function IdentityLayer:propagate(input, output) + output[1]:copy_from(input[1]) +end + +function IdentityLayer:back_propagate(bp_err, next_bp_err) + next_bp_err[1]:copy_from(bp_err) +end + +function IdentityLayer:update() +end + +function IdentityLayer:get_params() + return nerv.ParamRepo({}) +end |