Autograd node for scalar-exponent power: .
The exponent is a Python float (here promoted to double) captured
on the node at forward time; the input tensor is saved so the backward
pass can reconstruct via the same backend kernel.
Math
Forward
Backward
\cdot \frac{\partial L}{\partial y_i}$$ **See Also** `RPowScalarBackward`, `pow_scalar_op`.Attributes
exp_doublegrad_formula to compute and the leading multiplier.schema_v1OpSchema"pow_scalar" with AmpPolicy::ForceFP32 (integer / half precision are unsafe for arbitrary exponents).Notes
Capturing only the scalar (rather than baking it into the op name) keeps
the op table small. pow_scalar is reused inside grad_formula to
compute — no separate "decrement-exponent" kernel.
Static methods
1Forward dispatch with scalar capture — computes and wires the backward node manually so exp is persisted.
Parameters
aconst TensorImplPtr&expdoubleReturns
TensorImplPtrOutput tensor with the same shape and (post-promotion) dtype as a; the backward node carries exp.
Methods
2Computes from the saved input and the captured exp_.
Parameters
gconst Storage&Returns
StorageGradient with respect to x — same shape, dtype, and device as the saved input.
grad_formula_impl
→TensorImplPtrint grad_formula_impl(const int & g, const int & a, const int &)Graph-mode equivalent of grad_formula used when higher-order autograd is enabled — produces a fresh TensorImpl whose own backward chain remains intact.
Math
Parameters
gconst TensorImplPtr&aconst TensorImplPtr&/* out */const TensorImplPtr&grad_formula_impl overrides).Returns
TensorImplPtrTensor representing with a live autograd graph.