pylint icon indicating copy to clipboard operation
pylint copied to clipboard

Pylint complains functions in torch.linalg not callable.

Open hzhangxyz opened this issue 9 months ago • 1 comments

Bug description

"""
Test pytorch linalg module with pylint
"""

import torch


def my_qr_decomposition(tensor: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
    """
    My QR
    """
    tensor_q, tensor_r = torch.linalg.qr(tensor)
    return tensor_q, tensor_r

Configuration

No response

Command used

python -m pylint main.py "--generated-member=torch.*,torch.linalg.*"

Pylint output

************* Module main
main.py:12:25: E1102: torch.linalg.qr is not callable (not-callable)

-----------------------------------
Your code has been rated at 0.00/10

Expected behavior

It is expected that pylint knows torch.linalg.qr is callable

Pylint version

pylint 3.0.2
astroid 3.0.1
Python 3.11.5 (main, Aug 28 2023, 12:39:56) [GCC 11.4.0]

OS / Environment

github action, see details at https://github.com/hzhangxyz/test-pytorch-linalg-pylint/actions/runs/6761431449/job/18376293735 .

Note: pylint 2.17.7 works well in this examples.

Additional dependencies

pytorch==2.0.1+cpu

hzhangxyz avatar Nov 05 '23 12:11 hzhangxyz

I'm experiencing the same with some of the torch functionals (torch.nn.functional.(pad|conv2d)).

enrico-stauss avatar Jan 03 '24 20:01 enrico-stauss