-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Closed
Description
🚀 Feature
Several detection models make use of an attribute _has_warned
which was originally used by JIT to avoid throwing the same warning multiple times:
vision/torchvision/models/detection/retinanet.py
Lines 373 to 374 in 9778d26
# used only on torchscript mode | |
self._has_warned = False |
vision/torchvision/models/detection/retinanet.py
Lines 554 to 556 in 9778d26
if not self._has_warned: | |
warnings.warn("RetinaNet always returns a (Losses, Detections) tuple in scripting") | |
self._has_warned = True |
JIT should now be able to handle this automatically without the need of this variable. Thus we should remove the specific variable and confirm that calling forward multiple times on a JIT-scripted model produces a single warning. If that's indeed the case, we can remove it from all places:
- RetinaNet
- GeneralizedRCNN
- SSD (pending merge at Add SSD architecture with VGG16 backbone #3403)