Skip to content

Commit

Permalink
Replace distutils with packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed May 31, 2024
1 parent 5697e73 commit 948de9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ classifiers = [
"Operating System :: Microsoft :: Windows",
]
dependencies = [
"packaging",
"torch",
]

Expand Down
6 changes: 3 additions & 3 deletions thop/profile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from distutils.version import LooseVersion
from packaging.version import Version

from thop.rnn_hooks import *
from thop.vision.basic_hooks import *
Expand All @@ -7,7 +7,7 @@
# logger.setLevel(logging.INFO)
from .utils import prGreen, prRed, prYellow

if LooseVersion(torch.__version__) < LooseVersion("1.0.0"):
if Version(torch.__version__) < Version("1.0.0"):
logging.warning(
"You are using an old version PyTorch {version}, which THOP does NOT support.".format(version=torch.__version__)
)
Expand Down Expand Up @@ -61,7 +61,7 @@
nn.PixelShuffle: zero_ops,
}

if LooseVersion(torch.__version__) >= LooseVersion("1.1.0"):
if Version(torch.__version__) >= Version("1.1.0"):
register_hooks.update({nn.SyncBatchNorm: count_normalization})


Expand Down

0 comments on commit 948de9d

Please sign in to comment.