github / github/codeql

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

Abierto
#4,183 2 comentarios 0 reacciones 0 asignados Ver en GitHub
false-positive Python
Lenguaje dominante
CodeQL
Estrellas
10.1k
Forks
2.1k
Merge medio
2 d 15 h
PR fusionados (30 d)
141

Descripción

**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)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.