mindspore.ops.float_power
- mindspore.ops.float_power(input, exponent)[source]
Computes the first input to the power of the second input. For the real number type, cast input and exponent to mindspore.float64 to calculate.
Note
Currently, complex type calculation is not supported.
- Parameters
- Returns
Tensor whose data type is mindspore.float64.
- Supported Platforms:
GPU
CPU
Examples
>>> import mindspore >>> # case 1: When exponent is scalar: >>> input = mindspore.tensor([-1.5, 0., 2.]) >>> output = mindspore.ops.float_power(input, 2) >>> print(output) [2.25 0. 4. ] >>> >>> # case 2: When exponent is a tensor: >>> exponent = mindspore.tensor([0, 1, 2]) >>> output = mindspore.ops.float_power(input, exponent) >>> print(output) [1. 0. 4.]