Skip to content

[feature req. for torch.inverse] optional return for indicating that whether input is not invertable or not. #25095

@7starsea

Description

@7starsea

🚀 Feature

torch.inverse(input) -> (output, indicator)
dimension of input: (*, n, n),
dimension of (output, indicator): (*, n, n), (*,)

output is the inverse of input, and indicator indicate whether the input is invertable or not.
If (some of) the input is not invertable, do not incur a RuntimeError.

Motivation

torch.inverse will incur a RuntimeError when (some of) input is not invertable. If we want to invert a batch of matrices, a single singular matrix will ruin the whole inverting task.

Pitch

Alternatives

Additional context

cc @vincentqb @vishwakftw @jianyuh @nikitaved @pearu @mruberry @heitorschueroff @ssnl

Metadata

Metadata

Assignees

No one assigned

    Labels

    function requestA request for a new function or the addition of new arguments/modes to an existing function.module: 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