mindspore.mint.inverse

View Source On AtomGit
mindspore.mint.inverse(input)[source]

Compute the inverse of the input matrix.

Parameters

input (Tensor) – A matrix to be calculated. The input tensor must be at least 2-D, at most 6-D. The size of the last two dimensions must be the same. The matrix must be invertible.

Returns

Tensor, with the same type and shape as input.

Raises
  • ValueError – If the size of the last two dimensions of input is not the same.

  • ValueError – If input is not empty and its dimensions are less than 2.

  • ValueError – If the dimensions of input are larger than 6.

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> x = mindspore.tensor([[1., 2.], [3., 4.]], mindspore.float32)
>>> print(mindspore.mint.inverse(x))
[[-2.0000002   1.0000001 ]
 [ 1.5000001  -0.50000006]]