class Chainer::Functions::Math::PowVarVar
Public Instance Methods
backward(x, gy)
click to toggle source
# 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)
click to toggle source
# File lib/chainer/functions/math/basic_math.rb, line 94 def forward(x) @y = Utils::Array.force_array(x[0] ** x[1]) [@y] end