-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Needs triage 📥Just created, needs acknowledgment, triage, and proper labellingJust created, needs acknowledgment, triage, and proper labelling
Description
Bug description
Bug description
Pylint incorrectly reports E1102: not-callable for torch.nn.functional.one_hot regardless of how it’s referenced:
via alias: from torch.nn import functional as F; F.one_hot(...)
fully qualified: torch.nn.functional.one_hot(...)
direct import: from torch.nn.functional import one_hot; one_hot(...)
Minimal example:
not_callable.py:
import torch
from torch.nn.functional import one_hot
from torch.nn import functional as F
if __name__ == "__main__":
t0 = one_hot(torch.tensor([0, 1, 2]), num_classes=4)
t1 = F.one_hot(torch.tensor([0, 1, 2]), num_classes=4)
t2 = torch.nn.functional.one_hot(torch.tensor([0, 1, 2]), num_classes=4)Command used
pylint .\not_callable.pyPylint output
************* Module not_callable
not_callable.py:7:11: E1102: one_hot is not callable (not-callable)
not_callable.py:8:12: E1102: F.one_hot is not callable (not-callable)
not_callable.py:9:12: E1102: torch.nn.functional.one_hot is not callable (not-callable)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)Expected behavior
Not raise an error in this case because it is clearly callable
Pylint version
Tried these versions:
pylint 3.3.9
astroid 3.3.11
Python 3.13.7 (main, Sep 2 2025, 14:16:00) [MSC v.1944 64 bit (AMD64)]
pylint 4.0.2
astroid 4.0.1
Python 3.13.7 (main, Sep 2 2025, 14:16:00) [MSC v.1944 64 bit (AMD64)]OS / Environment
No response
Additional dependencies
torch==2.9.0Metadata
Metadata
Assignees
Labels
Needs triage 📥Just created, needs acknowledgment, triage, and proper labellingJust created, needs acknowledgment, triage, and proper labelling