Class: DNN::Layers::Layer
- Inherits:
-
Object
- Object
- DNN::Layers::Layer
- Defined in:
- lib/dnn/core/layers.rb
Overview
Super class of all optimizer classes.
Direct Known Subclasses
Activations::LeakyReLU, Activations::ReLU, Activations::Sigmoid, Activations::Softplus, Activations::Softsign, Activations::Tanh, Dropout, Flatten, HasParamLayer, InputLayer, OutputLayer, Pool2D, Reshape, UnPool2D
Instance Method Summary collapse
-
#backward ⇒ Object
Backward propagation.
-
#build(model) ⇒ Object
Build the layer.
-
#built? ⇒ Boolean
Does the layer have already been built?.
-
#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(merge_hash = nil) ⇒ Object
Layer to a hash.
Constructor Details
#initialize ⇒ Layer
Returns a new instance of Layer.
6 7 8 |
# File 'lib/dnn/core/layers.rb', line 6 def initialize @built = false end |
Instance Method Details
#backward ⇒ Object
Backward propagation.
25 |
# File 'lib/dnn/core/layers.rb', line 25 def backward() end |
#build(model) ⇒ Object
Build the layer.
11 12 13 14 |
# File 'lib/dnn/core/layers.rb', line 11 def build(model) @model = model @built = true end |
#built? ⇒ Boolean
Does the layer have already been built?
17 18 19 |
# File 'lib/dnn/core/layers.rb', line 17 def built? @built end |
#forward ⇒ Object
Forward propagation.
22 |
# File 'lib/dnn/core/layers.rb', line 22 def forward() end |
#prev_layer ⇒ Object
Get the previous layer.
40 41 42 |
# File 'lib/dnn/core/layers.rb', line 40 def prev_layer @model.get_prev_layer(self) end |
#shape ⇒ Object
Get the shape of the layer.
28 29 30 |
# File 'lib/dnn/core/layers.rb', line 28 def shape prev_layer.shape end |
#to_hash(merge_hash = nil) ⇒ Object
Layer to a hash.
33 34 35 36 37 |
# File 'lib/dnn/core/layers.rb', line 33 def to_hash(merge_hash = nil) hash = {class: self.class.name} hash.merge!(merge_hash) if merge_hash hash end |