Class: Chainer::Functions::Math::Neg

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



13
14
15
# File 'lib/chainer/functions/math/basic_math.rb', line 13

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

#forward(x) ⇒ Object



9
10
11
# File 'lib/chainer/functions/math/basic_math.rb', line 9

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

#labelObject



5
6
7
# File 'lib/chainer/functions/math/basic_math.rb', line 5

def label
  '__neg__'
end