Class: DNN::Layers::Mul
- Inherits:
-
MergeLayer
- Object
- Layer
- MergeLayer
- DNN::Layers::Mul
- Includes:
- LayerNode
- Defined in:
- lib/dnn/core/layers/math_layers.rb
Instance Attribute Summary
Attributes inherited from Layer
Instance Method Summary collapse
Methods included from LayerNode
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
103 104 105 106 107 |
# File 'lib/dnn/core/layers/math_layers.rb', line 103 def backward_node(dy) dx1 = MathUtils.sum_to(dy * @x2, @x1.shape) dx2 = MathUtils.sum_to(dy * @x1, @x2.shape) [dx1, dx2] end |
#forward_node(x1, x2) ⇒ Object
98 99 100 101 |
# File 'lib/dnn/core/layers/math_layers.rb', line 98 def forward_node(x1, x2) @x1, @x2 = x1, x2 x1 * x2 end |