Skip to content

torch.linalg.solve is not consistent with A.inv @ B�?#71385

Closed
@TestSomething22

Description

@TestSomething22

🐛 Describe the bug

Similar with #71384, based on the documentation of torch.linalg.inv, torch.linalg.solve(A, B) == A.inv() @ B. But there some some conterexamples:

import torch
A = torch.rand([2, 3, 3], dtype=torch.float64)
B = torch.rand([2, 3], dtype=torch.float64)
print(torch.linalg.solve(A, B))
# succeed
torch.linalg.inv(A) @ B
# RuntimeError: mat1 and mat2 shapes cannot be multiplied (6x3 and 2x3)

Versions

pytorch: 1.10.1

cc @brianjo @mruberry @jianyuh @nikitaved @pearu @walterddr @IvanYashchuk @xwang233 @lezcano

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issuemodule: docsRelated to our documentation, both in docs/ and docblocksmodule: linear algebraIssues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmultriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions