Class: DNN::Link
- Inherits:
-
Object
- Object
- DNN::Link
- Defined in:
- lib/dnn/core/link.rb
Instance Attribute Summary collapse
-
#layer ⇒ Object
Returns the value of attribute layer.
-
#prev ⇒ Object
Returns the value of attribute prev.
Instance Method Summary collapse
- #backward(dy) ⇒ Object
-
#initialize(prev = nil, layer = nil) ⇒ Link
constructor
A new instance of Link.
Constructor Details
#initialize(prev = nil, layer = nil) ⇒ Link
Returns a new instance of Link.
6 7 8 9 |
# File 'lib/dnn/core/link.rb', line 6 def initialize(prev = nil, layer = nil) @prev = prev @layer = layer end |
Instance Attribute Details
#layer ⇒ Object
Returns the value of attribute layer.
4 5 6 |
# File 'lib/dnn/core/link.rb', line 4 def layer @layer end |
#prev ⇒ Object
Returns the value of attribute prev.
3 4 5 |
# File 'lib/dnn/core/link.rb', line 3 def prev @prev end |
Instance Method Details
#backward(dy) ⇒ Object
11 12 13 14 |
# File 'lib/dnn/core/link.rb', line 11 def backward(dy) dy = @layer.backward(dy) @prev&.backward(dy) end |