Class: DNN::Layers::Div
- Inherits:
-
MergeLayer
- Object
- Layer
- MergeLayer
- DNN::Layers::Div
- Includes:
- MergeLayerNode
- Defined in:
- lib/dnn/core/layers/math_layers.rb
Instance Attribute Summary
Attributes inherited from Layer
Instance Method Summary collapse
Methods included from MergeLayerNode
Methods inherited from MergeLayer
Methods inherited from Layer
#build, #built?, call, #call, #clean, #compute_output_shape, #forward, from_hash, #initialize, #load_hash, #to_hash
Constructor Details
This class inherits a constructor from DNN::Layers::Layer
Instance Method Details
#backward_node(dy) ⇒ Object
61 62 63 64 65 |
# File 'lib/dnn/core/layers/math_layers.rb', line 61 def backward_node(dy) dx1 = dy / @x2 dx2 = dy * -(@x1 / @x2**2) [dx1, dx2] end |
#forward_node(x1, x2) ⇒ Object
56 57 58 59 |
# File 'lib/dnn/core/layers/math_layers.rb', line 56 def forward_node(x1, x2) @x1, @x2 = x1, x2 x1 / x2 end |