Skip to content

Fix the Doc of pivot in torch.lu #159616

@ILCSFNO

Description

@ILCSFNO

📚 The doc issue

The doc of torch.lu() shows its description as below:

pivot (bool, optional): controls whether pivoting is done. Default: ``True``

Think that it should be the same as:

pivot (bool, optional): Whether to compute the LU decomposition with partial pivoting, or the regular LU
decomposition. :attr:`pivot`\ `= False` not supported on CPU. Default: `True`.

I accept that it should raise error, but need to note on doc.

Both have the same action on repro, especially on CPU aspect:

Repro

import torch
import numpy as np

data = np.random.rand(10, 10)
input_data = torch.from_numpy(data).float()
torch.lu(input_data, pivot=False) # RuntimeError: linalg.lu_factor: LU without pivoting is not implemented on the CPU
torch.linalg.lu_factor(input_data, pivot=False) # RuntimeError: linalg.lu_factor: LU without pivoting is not implemented on the CPU

Thanks for noting!

Suggest a potential alternative/fix

  • Fix the doc of torch.lu() to meet the usage limitaion.

cc @svekars @sekyondaMeta @AlannaBurke

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionablemodule: docsRelated to our documentation, both in docs/ and docblockstriagedThis 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