latest (dev)
Copy
Latest development documentation · Updated 2026-10-15
tensorplay.functional.float_power
- tensorplay.functional.float_power(input, exponent, *, out=None) Tensor[source]
Raises
inputto the power ofexponent, elementwise, in double precision. If neither input is complex returns atensorplay.float64tensor, and if one or more inputs is complex returns atensorplay.complex128tensor.Note
This function always computes in double precision, unlike
tensorplay.pow(), which implements more typical type promotion. This is useful when the computation needs to be performed in a wider or more precise dtype, or the results of the computation may contain fractional values not representable in the input dtypes, like when an integer base is raised to a negative integer exponent.- Parameters:
- Keyword Arguments:
out (Tensor, optional) – the output tensor.
Example:
>>> a = tensorplay.randint(10, (4,)) >>> a tensor([6, 4, 7, 1]) >>> tensorplay.float_power(a, 2) tensor([36., 16., 49., 1.], dtype=tensorplay.float64) >>> a = tensorplay.arange(1, 5) >>> a tensor([ 1, 2, 3, 4]) >>> exp = tensorplay.tensor([2, -3, 4, -5]) >>> exp tensor([ 2, -3, 4, -5]) >>> tensorplay.float_power(a, exp) tensor([1.0000e+00, 1.2500e-01, 8.1000e+01, 9.7656e-04], dtype=tensorplay.float64)
Help improve this page
Found an error, an unclear step, or a missing example?

