Class: Chainer::Functions::Math::PowVarVar
- Inherits:
-
Chainer::FunctionNode
- Object
- Chainer::FunctionNode
- Chainer::Functions::Math::PowVarVar
- 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(x, gy) ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/chainer/functions/math/basic_math.rb', line 99 def backward(x, gy) one = x[1].class.ones[0] gx0 = Utils::Array.force_array(x[1] * (x[0] ** (x[1] - one)) * gy[0]) xm = Chainer.get_array_module(x[0]) gx1 = Utils::Array.force_array(xm::NMath.log(x[0]) * @y * gy[0]) [gx0, gx1] end |
#forward(x) ⇒ Object
94 95 96 97 |
# File 'lib/chainer/functions/math/basic_math.rb', line 94 def forward(x) @y = Utils::Array.force_array(x[0] ** x[1]) [@y] end |