Lyken17 / pytorch-OpCounter

Count the MACs / FLOPs of your PyTorch model.
MIT License
4.85k stars 528 forks source link

/opt/conda/lib/python3.8/site-packages/thop/vision/basic_hooks.py:115: UserWarning: __floordiv__ is deprecated, and its behavior will change in a future version of pytorch. #177

Closed glenn-jocher closed 2 years ago

glenn-jocher commented 2 years ago

Running YOLOv5 in Docker image with torch 1.11.0 produces this thop warning. It appears to apply generally to all PyTorch models.

/opt/conda/lib/python3.8/site-packages/thop/vision/basic_hooks.py:115: UserWarning: __floordiv__ is deprecated, and its behavior will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
Lyken17 commented 2 years ago

Hi @glenn-jocher ,thanks for notifiying me about this.

This is updated in https://github.com/Lyken17/pytorch-OpCounter/commit/66ec784fb0c53c7c71e291c6b7162d55d28c737e

glenn-jocher commented 2 years ago

@Lyken17 it's fixed! Thanks for the speedy response :)

Lyken17 commented 2 years ago

Welcome :) Love your yolov5 project.