github / codeql

CodeQL: the libraries and queries that power security researchers around the world, as well as code scanning in GitHub Advanced Security
https://codeql.github.com
MIT License
7.62k stars 1.52k forks source link

LGTM.com - false positive - Non-callable class errors for classes that inherit from callable torch.nn.Module #4183

Open mfl28 opened 4 years ago

mfl28 commented 4 years ago

Description of the false positive

I get Call to a non-callable of class ... error alerts for PyTorch classes that inherit from the callable torch.nn.Module class:

  1. Class torch.nn.CrossEntropyLoss This class inherits from _WeightedLoss which inherits form _Loss which inherits from torch.nn.Module (see here for the source code).
  2. Class torch.nn.ReflectionPad2d This class inherits from _ReflectionPadNd which inherits from torch.nn.Module (see here for the source code).

torch.nn.Module defines the __call__ method as can be seen here.

URL to the alert on the project page on LGTM.com CrossEntropyLoss errors: alert-1, alert-2 ReflectionPad2d error: alert

RasmusWL commented 4 years ago

Hi @mfi28, thanks for your report! I agree that this is a FP :+1:

We're currently busy reworking large parts of the Python QL libraries, so we won't be focusing on fixing this until later this year.

mfl28 commented 4 years ago

Sounds good, thanks for the info!