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
- #build(model) ⇒ Object
-
#initialize ⇒ HasParamLayer
constructor
A new instance of HasParamLayer.
-
#update ⇒ Object
Update the parameters.
Methods inherited from Layer
#backward, #builded?, #forward, #prev_layer, #shape, #to_hash
Constructor Details
#initialize ⇒ HasParamLayer
Returns a new instance of HasParamLayer.
49 50 51 52 |
# File 'lib/dnn/core/layers.rb', line 49 def initialize @params = {} @grads = {} end |
Instance Attribute Details
#grads ⇒ Object (readonly)
Differential value of parameter of layer.
47 48 49 |
# File 'lib/dnn/core/layers.rb', line 47 def grads @grads end |
#params ⇒ Object (readonly)
The parameters of the layer.
46 47 48 |
# File 'lib/dnn/core/layers.rb', line 46 def params @params end |
Instance Method Details
#build(model) ⇒ Object
54 55 56 57 |
# File 'lib/dnn/core/layers.rb', line 54 def build(model) super init_params end |
#update ⇒ Object
Update the parameters.
60 61 62 |
# File 'lib/dnn/core/layers.rb', line 60 def update @model.optimizer.update(self) end |