Skip to content
fn

pow_scalar_op

→TensorImplPtr
int pow_scalar_op(const int & a, double exp)

Element-wise scalar-exponent power — returns aexpa^{\text{exp}} with a fully wired autograd node.

Math

\frac{\partial y_i}{\partial x_i} = \text{exp} \cdot x_i^{\text{exp} - 1}$$ **Shape** Output shape equals input shape (elementwise). **See Also** `rpow_scalar_op`, `PowScalarBackward`.

Parameters

aTensorImplPtr
Input tensor (promoted to FP32 by the op schema).
expdouble
Scalar exponent.

Returns

TensorImplPtr

Output tensor with the same shape as a; gradient is exp⋅xexp−1⋅g\text{exp} \cdot x^{\text{exp}-1} \cdot g.