Class: Chainer::Functions::Math::MulConstant
- Inherits:
-
Chainer::Function
- Object
- Chainer::Function
- Chainer::Functions::Math::MulConstant
- Defined in:
- lib/chainer/functions/math/basic_math.rb
Instance Attribute Summary
Attributes inherited from Chainer::Function
#inputs, #output_data, #outputs, #rank, #retain_after_backward
Instance Method Summary collapse
- #backward(x, gy) ⇒ Object
- #forward(x) ⇒ Object
-
#initialize(value) ⇒ MulConstant
constructor
A new instance of MulConstant.
Methods inherited from Chainer::Function
#call, #forward_cpu, #retain_inputs, #retain_outputs
Constructor Details
#initialize(value) ⇒ MulConstant
Returns a new instance of MulConstant.
64 65 66 |
# File 'lib/chainer/functions/math/basic_math.rb', line 64 def initialize(value) @value = value end |
Instance Method Details
#backward(x, gy) ⇒ Object
72 73 74 |
# File 'lib/chainer/functions/math/basic_math.rb', line 72 def backward(x, gy) [Utils::Array.force_array(@value * gy[0])] end |
#forward(x) ⇒ Object
68 69 70 |
# File 'lib/chainer/functions/math/basic_math.rb', line 68 def forward(x) [Utils::Array.force_array(@value * x[0])] end |