Class: Chainer::Functions::Math::PowVarVar
- Inherits:
-
Chainer::Function
- Object
- Chainer::Function
- Chainer::Functions::Math::PowVarVar
- 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
Methods inherited from Chainer::Function
#call, #forward_cpu, #initialize, #retain_inputs, #retain_outputs
Constructor Details
This class inherits a constructor from Chainer::Function
Instance Method Details
#backward(x, gy) ⇒ Object
94 95 96 97 98 99 |
# File 'lib/chainer/functions/math/basic_math.rb', line 94 def backward(x, gy) one = x[1].class.ones[0] gx0 = Utils::Array.force_array(x[1] * (x[0] ** (x[1] - one)) * gy[0]) gx1 = Utils::Array.force_array(Numo::NMath.log(x[0]) * @y * gy[0]) [gx0, gx1] end |
#forward(x) ⇒ Object
89 90 91 92 |
# File 'lib/chainer/functions/math/basic_math.rb', line 89 def forward(x) @y = Utils::Array.force_array(x[0] ** x[1]) [@y] end |