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
- Returns
Tensor.
- Raises
TypeError – If hermitian is not a bool.
TypeError – If x is not a Tensor.
ValueError – If the dimension of x is less than 2.
- 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 ]]