class DNN::Layers::Concatenate
Attributes
axis[R]
Public Class Methods
new(axis: 1)
click to toggle source
Calls superclass method
DNN::Layers::Layer::new
# File lib/dnn/core/layers/merge_layers.rb, line 26 def initialize(axis: 1) super() @axis = axis end
Public Instance Methods
backward_node(dy)
click to toggle source
# File lib/dnn/core/layers/merge_layers.rb, line 37 def backward_node(dy) dy.split([@x1_dim, @x1_dim + @x2_dim], axis: @axis) end
forward_node(x1, x2)
click to toggle source
# File lib/dnn/core/layers/merge_layers.rb, line 31 def forward_node(x1, x2) @x1_dim = x1.shape[@axis] @x2_dim = x2.shape[@axis] x1.concatenate(x2, axis: @axis) end
load_hash(hash)
click to toggle source
# File lib/dnn/core/layers/merge_layers.rb, line 45 def load_hash(hash) initialize(axis: hash[:axis]) end
to_hash()
click to toggle source
Calls superclass method
DNN::Layers::Layer#to_hash
# File lib/dnn/core/layers/merge_layers.rb, line 41 def to_hash super(axis: @axis) end