Python wrappers
Public Python APIs implemented by this engine symbol.Autograd node for elementwise tensor-tensor power with NumPy broadcasting.
Saves both inputs a and b (kSavesInputs = true inherited from
BinaryKernel) because both are needed in the backward formulas.
The gradient w.r.t. a is finite for any real ; the gradient w.r.t.
b is undefined when because is not real — in that
regime the returned gradient is non-finite and should be masked by the
caller.
Math
Shape
Inputs a, b follow NumPy broadcasting rules; the output y takes
the broadcast shape. Both backward branches are sum-reduced back to the
original input shapes by sum_to_shape in the apply trampoline.
See Also
mul_op : Elementwise multiplication. log_op : Natural logarithm (used by the branch).
Attributes
schema_v1OpSchema"pow", version 1, AmpPolicy::ForceFP32, deterministic. FP32 is forced because log() and fractional exponentiation are numerically unstable in half/bfloat precision.Notes
For tensor-scalar power (constant exponent) prefer the scalar variant in
ScalarParam.h — it skips saving the exponent tensor and avoids the
log(a) * a^b branch entirely. See BinaryKernel for the
broadcasting / save-tensor / reduce-to-shape machinery.
Static methods
1Methods
2Compute the gradients for both inputs given the output gradient.
grad_formula_impl
int grad_formula_impl(const int & g, const int & a_ptr, const int & b_ptr)Graph-mode gradient for create_graph=True. dA = b * a^(b-1) * g; dB = log(a) * a^b * g