Class: DNN::Layers::Div
- Inherits:
-
MergeLayer
- Object
- Layer
- MergeLayer
- DNN::Layers::Div
- Defined in:
- lib/dnn/core/layers/math_layers.rb
Instance Attribute Summary
Attributes inherited from Layer
Instance Method Summary collapse
Methods inherited from MergeLayer
Methods included from MergeLayerNode
Methods inherited from Layer
#build, #built?, call, #call, #clean, #forward, from_hash, #initialize, #load_hash, #output_shape, #to_hash
Constructor Details
This class inherits a constructor from DNN::Layers::Layer
Instance Method Details
#backward_node(dy) ⇒ Object
41 42 43 44 45 |
# File 'lib/dnn/core/layers/math_layers.rb', line 41 def backward_node(dy) dx1 = dy / @x2 dx2 = dy * -(@x1 / @x2**2) [dx1, dx2] end |
#forward_node(x1, x2) ⇒ Object
36 37 38 39 |
# File 'lib/dnn/core/layers/math_layers.rb', line 36 def forward_node(x1, x2) @x1, @x2 = x1, x2 x1 / x2 end |