mindspore.ops.inverse
- mindspore.ops.inverse(input)[source]
Compute the inverse of the input matrix.
- Parameters
input (Tensor) – A matrix to be calculated. Input input must be at least two dimensions, and the size of the last two dimensions must be the same size.
- Returns
Tensor, has the same type and shape as input input.
- Raises
TypeError – If input is not a Tensor.
ValueError – If the size of the last two dimensions of input is not the same.
ValueError – If the dimension of input is less than 2.
- Supported Platforms:
GPU
CPU
Examples
>>> from mindspore import Tensor, ops >>> from mindspore import dtype as mstype >>> x = Tensor([[1., 2.], [3., 4.]], mstype.float32) >>> print(ops.inverse(x)) [[-2. 1. ] [ 1.5 -0.5]]