Read the equation
The derivative with respect to x is p x^(p−1) when the real-valued power is defined and differentiable. The helper treats p as a constant and does not compute an exponent gradient. Negative bases with noninteger p and some zero-base cases require explicit domain handling.
Terms & definitions
| Term | Meaning in this source |
|---|---|
| x | Base |
| p | Fixed exponent |
| z | Power output |
How it works
Read the definition from its right-hand expression to the quantity on the left. Its surrounding source records the intended input, state, or parameter context. Where the source leaves an operation unspecified, this page preserves that gap.
Assumptions & limits
Source recovery establishes that the expression appears in this record. Its mathematical validity, implementation behavior, and interpretation must be assessed separately. See the linked source and research notes for the checks available for this version.
Original context
Read the surrounding source passage
z->inputs = {x};
z->backward_fn = [x, z]() {
x->grad += z->grad / (x->value + EPSILON);
};
return tape.record(z);
}
// Power: z = x^p, dz/dx = p * x^(p-1)
inline GradNodePtr pow_op(GradNodePtr x, double p, TapeRecorder& tape) {
auto z = std::make_shared<GradNode>(std::pow(x->value, p));
z->inputs = {x};
z->backward_fn = [x, z, p]() {
x->grad += z->grad * p * std::pow(x->value, p - 1.0);
};
return tape.record(z);
}
// Softmax (single element with sum): used for attention weightsExact original notation
Power: z = x^p, dz/dx = p * x^(p-1)