Class: Chainer::Functions::Math::AddConstant
- Inherits:
-
Chainer::FunctionNode
- Object
- Chainer::FunctionNode
- Chainer::Functions::Math::AddConstant
- Defined in:
- lib/chainer/functions/math/basic_math.rb
Instance Attribute Summary
Attributes inherited from Chainer::FunctionNode
Instance Method Summary collapse
- #backward(indexes, gy) ⇒ Object
- #forward(x) ⇒ Object
-
#initialize(value) ⇒ AddConstant
constructor
A new instance of AddConstant.
Methods inherited from Chainer::FunctionNode
#apply, #backward_accumulate, #forward_cpu, #get_retained_inputs, #get_retained_outputs, #label, #output_data, #retain_inputs, #retain_outputs, #unchain
Constructor Details
#initialize(value) ⇒ AddConstant
Returns a new instance of AddConstant.
29 30 31 |
# File 'lib/chainer/functions/math/basic_math.rb', line 29 def initialize(value) @value = value end |
Instance Method Details
#backward(indexes, gy) ⇒ Object
37 38 39 |
# File 'lib/chainer/functions/math/basic_math.rb', line 37 def backward(indexes, gy) [gy[0]] end |
#forward(x) ⇒ Object
33 34 35 |
# File 'lib/chainer/functions/math/basic_math.rb', line 33 def forward(x) [Utils::Array.force_array(x[0] + @value)] end |