From 9885efd3667dec1918b407f5edaf4dda2f4af2c0 Mon Sep 17 00:00:00 2001 From: UltralyticsAssistant Date: Thu, 20 Jun 2024 20:35:29 +0000 Subject: [PATCH] Auto-format by https://ultralytics.com/actions --- README.md | 3 ++- benchmark/evaluate_famous_models.py | 3 ++- benchmark/evaluate_rnn_models.py | 1 + tests/test_conv2d.py | 1 + tests/test_matmul.py | 1 + tests/test_relu.py | 1 + 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3cfa21e..7267aff 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,10 @@ pip install --upgrade git+https://github.com/ultralytics/thop.git To profile a model, you can use the following example: ```python +import torch from torchvision.models import resnet50 + from thop import profile -import torch model = resnet50() input = torch.randn(1, 3, 224, 224) diff --git a/benchmark/evaluate_famous_models.py b/benchmark/evaluate_famous_models.py index f36615c..f641bda 100644 --- a/benchmark/evaluate_famous_models.py +++ b/benchmark/evaluate_famous_models.py @@ -1,7 +1,8 @@ import torch -from thop.profile import profile from torchvision import models +from thop.profile import profile + model_names = sorted( name for name in models.__dict__ diff --git a/benchmark/evaluate_rnn_models.py b/benchmark/evaluate_rnn_models.py index 2c5060a..d1fad55 100644 --- a/benchmark/evaluate_rnn_models.py +++ b/benchmark/evaluate_rnn_models.py @@ -1,5 +1,6 @@ import torch import torch.nn as nn + from thop.profile import profile input_size = 160 diff --git a/tests/test_conv2d.py b/tests/test_conv2d.py index 6e3f974..e058e25 100644 --- a/tests/test_conv2d.py +++ b/tests/test_conv2d.py @@ -1,5 +1,6 @@ import torch import torch.nn as nn + from thop import profile diff --git a/tests/test_matmul.py b/tests/test_matmul.py index e0688b2..83cc361 100644 --- a/tests/test_matmul.py +++ b/tests/test_matmul.py @@ -1,5 +1,6 @@ import torch import torch.nn as nn + from thop import profile diff --git a/tests/test_relu.py b/tests/test_relu.py index ec916a6..88739e6 100644 --- a/tests/test_relu.py +++ b/tests/test_relu.py @@ -1,5 +1,6 @@ import torch import torch.nn as nn + from thop import profile