Class: DNN::MergeLayers::Mul

Inherits:
MergeLayer show all
Defined in:
lib/dnn/core/merge_layers.rb

Instance Attribute Summary

Attributes inherited from Layers::Layer

#input_shape, #name

Instance Method Summary collapse

Methods inherited from MergeLayer

call, #call

Methods inherited from Layers::Layer

#build, #built?, call, #call, from_hash, #initialize, #load_hash, #output_shape, #to_hash

Constructor Details

This class inherits a constructor from DNN::Layers::Layer

Instance Method Details

#backward(dy) ⇒ Object



37
38
39
# File 'lib/dnn/core/merge_layers.rb', line 37

def backward(dy)
  [dy * @x2, dy * @x1]
end

#forward(x1, x2) ⇒ Object



32
33
34
35
# File 'lib/dnn/core/merge_layers.rb', line 32

def forward(x1, x2)
  @x1, @x2 = x1, x2
  x1 * x2
end