mindspore.ops.float_power

View Source On Gitee
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
  • input (Union[Tensor, Number]) – The first input.

  • exponent (Union[Tensor, Number]) – The second input, if the first input is Number, it must be a Tensor.

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.]