Class: DNN::MergeLayers::MergeLayer

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

Direct Known Subclasses

Add, Concatenate, Mul

Instance Attribute Summary

Attributes inherited from Layers::Layer

#input_shape, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Layers::Layer

#backward, #build, #built?, #forward, from_hash, #initialize, #load_hash, #output_shape, #to_hash

Constructor Details

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

Class Method Details

.call(x1, x2, *args) ⇒ Object



5
6
7
# File 'lib/dnn/core/merge_layers.rb', line 5

def self.call(x1, x2, *args)
  self.new(*args).call(x1, x2)
end

Instance Method Details

#call(input1, input2) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/dnn/core/merge_layers.rb', line 9

def call(input1, input2)
  x1, prev_link1 = *input1
  x2, prev_link2 = *input2
  build(x1.shape[1..-1]) unless built?
  y = forward(x1, x2)
  link = TwoInputLink.new(prev_link1, prev_link2, self)
  [y, link]
end