Class: DNN::Layers::HasParamLayer

Inherits:
Layer
  • Object
show all
Defined in:
lib/dnn/core/layers.rb

Direct Known Subclasses

BatchNormalization, Conv2D, Dense

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Layer

#backward, #forward, #prev_layer, #shape

Constructor Details

#initializeHasParamLayer



35
36
37
38
# File 'lib/dnn/core/layers.rb', line 35

def initialize
  @params = {}
  @grads = {}
end

Instance Attribute Details

#gradsObject (readonly)

Differential value of parameter of layer.



33
34
35
# File 'lib/dnn/core/layers.rb', line 33

def grads
  @grads
end

#paramsObject (readonly)

The parameters of the layer.



32
33
34
# File 'lib/dnn/core/layers.rb', line 32

def params
  @params
end

Instance Method Details

#init(model) ⇒ Object



40
41
42
43
# File 'lib/dnn/core/layers.rb', line 40

def init(model)
  super
  init_params
end

#updateObject

Update the parameters.



46
47
48
# File 'lib/dnn/core/layers.rb', line 46

def update
  @model.optimizer.update(self)
end