Lyken17 / pytorch-OpCounter

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

Switched from distutils.version to pkg_resources #214

Open econeale opened 1 year ago

econeale commented 1 year ago

This PR fixes the following deprecation warnings:

.venv/lib/python3.11/site-packages/thop/profile.py:12
.venv/lib/python3.11/site-packages/thop/profile.py:12
  /Users/neale/panel-quality-imager/.venv/lib/python3.11/site-packages/thop/profile.py:12: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(torch.__version__) < LooseVersion("1.0.0"):

.venv/lib/python3.11/site-packages/thop/profile.py:68
.venv/lib/python3.11/site-packages/thop/profile.py:68
  /Users/neale/panel-quality-imager/.venv/lib/python3.11/site-packages/thop/profile.py:68: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(torch.__version__) >= LooseVersion("1.1.0"):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

This appears to be the same fix from #201 that doesn't appear to be merged and is closed by that author.