Class: DNN::Layers::HasParamLayer
Direct Known Subclasses
Instance Attribute Summary collapse
-
#grads ⇒ Object
readonly
Differential value of parameter of layer.
-
#params ⇒ Object
readonly
The parameters of the layer.
Instance Method Summary collapse
- #init(model) ⇒ Object
-
#initialize ⇒ HasParamLayer
constructor
A new instance of HasParamLayer.
-
#update ⇒ Object
Update the parameters.
Methods inherited from Layer
#backward, #forward, #prev_layer, #shape
Constructor Details
#initialize ⇒ HasParamLayer
35 36 37 38 |
# File 'lib/dnn/core/layers.rb', line 35 def initialize @params = {} @grads = {} end |
Instance Attribute Details
#grads ⇒ Object (readonly)
Differential value of parameter of layer.
33 34 35 |
# File 'lib/dnn/core/layers.rb', line 33 def grads @grads end |
#params ⇒ Object (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 |
#update ⇒ Object
Update the parameters.
46 47 48 |
# File 'lib/dnn/core/layers.rb', line 46 def update @model.optimizer.update(self) end |