From d3aea924c33e059028d48f8e1b0736aa2db722fb Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 5 Jul 2024 14:27:12 +0200 Subject: [PATCH] Refactor code for speed and clarity --- README.md | 2 +- 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, 2 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index de90800..3d3e4d6 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Welcome to the [THOP](https://github.com/ultralytics/thop) repository, your comprehensive solution for profiling PyTorch models by computing the number of Multiply-Accumulate Operations (MACs) and parameters. This tool is essential for deep learning practitioners to evaluate model efficiency and performance. -[![GitHub Actions](https://github.com/ultralytics/thop/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/thop/actions/workflows/main.yml) Discord +[![GitHub Actions](https://github.com/ultralytics/thop/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/thop/actions/workflows/main.yml) Discord Ultralytics Forums ## 📄 Description diff --git a/benchmark/evaluate_famous_models.py b/benchmark/evaluate_famous_models.py index f641bda..f36615c 100644 --- a/benchmark/evaluate_famous_models.py +++ b/benchmark/evaluate_famous_models.py @@ -1,7 +1,6 @@ import torch -from torchvision import models - from thop.profile import profile +from torchvision import models model_names = sorted( name diff --git a/benchmark/evaluate_rnn_models.py b/benchmark/evaluate_rnn_models.py index d1fad55..2c5060a 100644 --- a/benchmark/evaluate_rnn_models.py +++ b/benchmark/evaluate_rnn_models.py @@ -1,6 +1,5 @@ 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 11b000e..d3e7863 100644 --- a/tests/test_conv2d.py +++ b/tests/test_conv2d.py @@ -1,6 +1,5 @@ import torch import torch.nn as nn - from thop import profile diff --git a/tests/test_matmul.py b/tests/test_matmul.py index 227b94f..3fe3912 100644 --- a/tests/test_matmul.py +++ b/tests/test_matmul.py @@ -1,6 +1,5 @@ import torch import torch.nn as nn - from thop import profile diff --git a/tests/test_relu.py b/tests/test_relu.py index d45518e..77d30ba 100644 --- a/tests/test_relu.py +++ b/tests/test_relu.py @@ -1,6 +1,5 @@ import torch import torch.nn as nn - from thop import profile