mindspore.ops.pinv

mindspore.ops.pinv(x, *, atol=None, rtol=None, hermitian=False)[source]

Computes the (Moore-Penrose) pseudo-inverse of a matrix.

Parameters

x (Tensor) – A matrix to be calculated. The matrix must be at least two dimensions. Only float32, float64 are supported Tensor dtypes.

Keyword Arguments
  • atol (float, Tensor) – absolute tolerance value. Default: None.

  • rtol (float, Tensor) – relative tolerance value. Default: None.

  • hermitian (bool) – An optional bool. x is assumed to be symmetric if real. Default: False.

Returns

Tensor.

Raises
Supported Platforms:

CPU

Examples

>>> x = Tensor([[2., 1.], [1., 2.]], mindspore.float32)
>>> output = ops.pinv(x)
>>> print(output)
[[ 0.6666667  -0.33333334]
[-0.33333334  0.6666667 ]]