pylint icon indicating copy to clipboard operation
pylint copied to clipboard

False Positive E1136: PyTorch nn.Parameter.repeat (Value is unsubscriptable)

Open enrico-stauss opened this issue 1 year ago • 0 comments

Bug description

import torch

test = torch.nn.Parameter(torch.rand(2, 10, 1, 3))
test = test.repeat(1, 1, 3, 1)[:, :, 0, :]

Configuration

No response

Command used

pylint test.py

Pylint output

************* Module test
test.py:4:7: E1136: Value 'test.repeat(1, 1, 3, 1)' is unsubscriptable (unsubscriptable-object)

Expected behavior

No warning should be raised as the return of repeat is a torch.Tensor. It's possible though, that the issue has to be fixed on the PyTorch side.

Pylint version

pylint 3.0.3
astroid 3.0.2
Python 3.10.4 (main, Sep 11 2022, 20:39:17) [Clang 13.1.6 (clang-1316.0.21.2.5)]

OS / Environment

No response

Additional dependencies

torch==2.1.0

enrico-stauss avatar Dec 18 '23 13:12 enrico-stauss