Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
[ad_1]
On this article, we’re going to focus on find out how to compute the pseudoinverse of a matrix in Python utilizing PyTorch.
torch.linalg.pinv() methodology accepts a matrix and a batch of matrices as enter and returns a brand new tensor with the pseudoinverse of the enter matrix. if the enter is a batch of matrices then the output tensor additionally has the identical batch dimensions. This methodology additionally helps the enter of float, double, cfloat, and cdouble dtypes. The under syntax is used to compute the pseudoinverse of a matrix.
Syntax: torch.linalg.pinv(inp)
Parameters:
- inp: The place inp is a Matrix of Order M x N or a batch of matrices.
Returns: it would returns a brand new tensor with the pseudoinverse of the enter matrix.
Instance 1:
On this instance, we’ll perceive find out how to compute the pseudoinverse of a matrix in PyTorch.
|
Output:
Instance 2:
On this instance, we’ll compute the pseudoinverse of a batch of matrices in PyTorch.
|
Output:
[ad_2]