Skip to content
fn

rpow_scalar_op

→TensorImplPtr
int rpow_scalar_op(double base, const int & a)

Element-wise scalar-base reverse power — returns basea\text{base}^{a} with a fully wired autograd node.

Math

\frac{\partial y_i}{\partial x_i} = \ln(\text{base}) \cdot y_i$$ **Shape** Output shape equals input shape (elementwise). **See Also** `pow_scalar_op`, `RPowScalarBackward`.

Parameters

basedouble
Scalar base (must be positive for a real-valued gradient).
aTensorImplPtr
Input tensor — the exponent (promoted to FP32 by the op schema).

Returns

TensorImplPtr

Output tensor with the same shape as a; gradient is ln⁡(base)⋅y⋅g\ln(\text{base}) \cdot y \cdot g.

Raises

Gradient is undefined / non-real for ``base <= 0``; callers should
guard the base if they intend to backpropagate.