aboutsummaryrefslogtreecommitdiff
path: root/nerv/layer/identity.lua
blob: dc796fbde6a8df49c7c65057a60fc44c8bd83d31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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