fn

float_power

Tensor
float_power(x: Tensor | Scalar, y: Tensor | Scalar)
source

Element-wise power that always promotes operands to float64.

Unlike the regular lucid.pow, float_power upcasts both operands to float64 before exponentiation, so that negative bases raised to non-integer powers and very large exponents behave consistently without integer overflow or domain errors.

Parameters

xTensor | Scalar
Base.
yTensor | Scalar
Exponent.

Returns

Tensor

Element-wise x ** y evaluated in float64.

Notes

Mathematical definition:

outi=xiyi.\text{out}_i = x_i^{y_i}.

Promotion is mandatory — even integer inputs are cast to float64. The result is always float64 regardless of input dtype.

Examples

>>> import lucid
>>> x = lucid.tensor([2, 3], dtype=lucid.int32)
>>> lucid.float_power(x, 0.5).dtype
lucid.float64