Class: Chainer::Functions::Math::Sub

Inherits:
Chainer::FunctionNode show all
Defined in:
lib/chainer/functions/math/basic_math.rb

Instance Attribute Summary

Attributes inherited from Chainer::FunctionNode

#inputs, #outputs, #rank

Instance Method Summary collapse

Methods inherited from Chainer::FunctionNode

#apply, #backward_accumulate, #forward_cpu, #get_retained_inputs, #get_retained_outputs, #initialize, #output_data, #retain_inputs, #retain_outputs, #unchain

Constructor Details

This class inherits a constructor from Chainer::FunctionNode

Instance Method Details

#backward(indexes, gy) ⇒ Object



51
52
53
# File 'lib/chainer/functions/math/basic_math.rb', line 51

def backward(indexes, gy)
  [gy[0], -gy[0]]
end

#forward(x) ⇒ Object



47
48
49
# File 'lib/chainer/functions/math/basic_math.rb', line 47

def forward(x)
  [Utils::Array.force_array(x[0] - x[1])]
end

#labelObject



43
44
45
# File 'lib/chainer/functions/math/basic_math.rb', line 43

def label
  '_ - _'
end