class DNN::Layers::Sub

Public Instance Methods

backward_node(dy) click to toggle source
# File lib/dnn/core/layers/math_layers.rb, line 88
def backward_node(dy)
  dx1 = MathUtils.sum_to(dy, @x1_shape)
  dx2 = MathUtils.sum_to(-dy, @x2_shape)
  [dx1, dx2]
end
forward_node(x1, x2) click to toggle source
# File lib/dnn/core/layers/math_layers.rb, line 82
def forward_node(x1, x2)
  @x1_shape = x1.shape
  @x2_shape = x2.shape
  x1 - x2
end