From 9da022948a91e244fe0fb436fd28243258bdec7b Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 20 Jun 2024 22:35:56 +0200 Subject: [PATCH] Ultralytics Refactor https://ultralytics.com/actions (#29) Co-authored-by: UltralyticsAssistant --- README.md | 7 ++++--- thop/vision/basic_hooks.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1c2fefc..7267aff 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
- +Ultralytics logo # 🚀 THOP: PyTorch-OpCounter @@ -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) @@ -154,7 +155,7 @@ For bugs or feature requests, please open an issue on [GitHub Issues](https://gi space Ultralytics TikTok space - Ultralytics Instagram + Ultralytics Instagram space Ultralytics Discord diff --git a/thop/vision/basic_hooks.py b/thop/vision/basic_hooks.py index 9ee8975..f4dfce3 100644 --- a/thop/vision/basic_hooks.py +++ b/thop/vision/basic_hooks.py @@ -21,7 +21,7 @@ def zero_ops(m, x, y): def count_convNd(m: _ConvNd, x, y: torch.Tensor): """Calculate and add the number of convolutional operations (FLOPs) to the model's total operations count.""" x = x[0] - + m.total_ops += calculate_conv2d_flops( input_size=list(x.shape), output_size=list(y.shape),