Class: Chainer::Functions::Math::Mul
- Inherits:
-
Chainer::FunctionNode
- Object
- Chainer::FunctionNode
- Chainer::Functions::Math::Mul
- Defined in:
- lib/chainer/functions/math/basic_math.rb
Instance Attribute Summary
Attributes inherited from Chainer::FunctionNode
Instance Method Summary collapse
Methods inherited from Chainer::FunctionNode
#apply, #backward_accumulate, #forward_cpu, #get_retained_inputs, #get_retained_outputs, #initialize, #label, #output_data, #retain_inputs, #retain_outputs, #unchain
Constructor Details
This class inherits a constructor from Chainer::FunctionNode
Instance Method Details
#backward(indexes, gy) ⇒ Object
62 63 64 65 |
# File 'lib/chainer/functions/math/basic_math.rb', line 62 def backward(indexes, gy) xs = get_retained_inputs indexes.map { |i| gy[0] * xs[1 - i] } end |
#forward(x) ⇒ Object
57 58 59 60 |
# File 'lib/chainer/functions/math/basic_math.rb', line 57 def forward(x) retain_inputs([0, 1]) [Utils::Array.force_array(x[0] * x[1])] end |