github / github/codeql

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

Đang mở
#4,183 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
false-positive Python
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

**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](https://pytorch.org/docs/stable/_modules/torch/nn/modules/loss.html#CrossEntropyLoss) for the source code).
2. Class `torch.nn.ReflectionPad2d`
This class inherits from `_ReflectionPadNd` which inherits from `torch.nn.Module` (see [here](https://pytorch.org/docs/stable/_modules/torch/nn/modules/padding.html#ReflectionPad2d) for the source code).

`torch.nn.Module` defines the `__call__` method as can be seen [here](https://github.com/pytorch/pytorch/blob/8094228f26cdef24529bffadd6a6e43b56df2d6e/torch/nn/modules/module.py#L751).

**URL to the alert on the project page on LGTM.com**
`CrossEntropyLoss` errors: [alert-1](https://lgtm.com/projects/g/mfl28/MachineLearning/snapshot/6305daee10649072dd64b5f5f86076369655e6c9/files/mltools/classification/utils.py?sort=name&dir=ASC&mode=heatmap#xfb842e36390a0f89:1), [alert-2](https://lgtm.com/projects/g/mfl28/MachineLearning/snapshot/6305daee10649072dd64b5f5f86076369655e6c9/files/mltools/classification/utils.py?sort=name&dir=ASC&mode=heatmap#x7ecfd52bd6020a51:1)
`ReflectionPad2d` error: [alert](https://lgtm.com/projects/g/mfl28/MachineLearning/snapshot/6305daee10649072dd64b5f5f86076369655e6c9/files/mltools/segmentation/models.py?sort=name&dir=ASC&mode=heatmap#x1d7d7e0c7ca68410:1)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.