mindspore.mint.pow
- mindspore.mint.pow(input, exponent)[source]
Calculates the exponent power of each element in input.
When exponent is a Tensor, the shapes of input and exponent must be broadcastable.
\[out_{i} = input_{i} ^{ exponent_{i}}\]Warning
This is an experimental API that is subject to change or deletion.
- Parameters
- Returns
Tensor, the shape is the same as the one after broadcasting, and the data type is the one with higher precision or higher digits among the two inputs.
- Raises
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, mint >>> input = Tensor(np.array([1.0, 2.0, 4.0]), mindspore.float32) >>> exponent = 3.0 >>> output = mint.pow(input, exponent) >>> print(output) [ 1. 8. 64.] >>> >>> input = Tensor(np.array([1.0, 2.0, 4.0]), mindspore.float32) >>> exponent = Tensor(np.array([2.0, 4.0, 3.0]), mindspore.float32) >>> output = mint.pow(input, exponent) >>> print(output) [ 1. 16. 64.]