Class: DNN::Layers::Layer
- Inherits:
-
Object
- Object
- DNN::Layers::Layer
- Includes:
- Numo
- Defined in:
- lib/dnn/core/layers.rb
Overview
Super class of all optimizer classes.
Direct Known Subclasses
Dropout, Flatten, HasParamLayer, InputLayer, MaxPool2D, OutputLayer, Reshape
Instance Method Summary collapse
-
#backward ⇒ Object
Backward propagation.
-
#build(model) ⇒ Object
Initialize layer when model is compiled.
- #builded? ⇒ Boolean
-
#forward ⇒ Object
Forward propagation.
-
#initialize ⇒ Layer
constructor
A new instance of Layer.
-
#prev_layer ⇒ Object
Get the previous layer.
-
#shape ⇒ Object
Get the shape of the layer.
-
#to_hash ⇒ Object
Layer to a hash.
Constructor Details
#initialize ⇒ Layer
Returns a new instance of Layer.
8 9 10 |
# File 'lib/dnn/core/layers.rb', line 8 def initialize @builded = false end |
Instance Method Details
#backward ⇒ Object
Backward propagation.
26 |
# File 'lib/dnn/core/layers.rb', line 26 def backward() end |
#build(model) ⇒ Object
Initialize layer when model is compiled.
13 14 15 16 |
# File 'lib/dnn/core/layers.rb', line 13 def build(model) @builded = true @model = model end |
#builded? ⇒ Boolean
18 19 20 |
# File 'lib/dnn/core/layers.rb', line 18 def builded? @builded end |
#forward ⇒ Object
Forward propagation.
23 |
# File 'lib/dnn/core/layers.rb', line 23 def forward() end |
#prev_layer ⇒ Object
Get the previous layer.
39 40 41 |
# File 'lib/dnn/core/layers.rb', line 39 def prev_layer @model.layers[@model.layers.index(self) - 1] end |
#shape ⇒ Object
Get the shape of the layer.
29 30 31 |
# File 'lib/dnn/core/layers.rb', line 29 def shape prev_layer.shape end |
#to_hash ⇒ Object
Layer to a hash.
34 35 36 |
# File 'lib/dnn/core/layers.rb', line 34 def to_hash {name: self.class.name} end |