ultralytics-thop 0.0.3__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ultralytics_thop-0.2.3/PKG-INFO +188 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/pyproject.toml +9 -10
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/thop/__init__.py +2 -2
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/thop/profile.py +7 -16
 - ultralytics_thop-0.2.3/ultralytics_thop.egg-info/PKG-INFO +188 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/ultralytics_thop.egg-info/SOURCES.txt +0 -1
 - ultralytics_thop-0.2.3/ultralytics_thop.egg-info/requires.txt +2 -0
 - ultralytics_thop-0.0.3/PKG-INFO +0 -847
 - ultralytics_thop-0.0.3/thop/__version__.py +0 -1
 - ultralytics_thop-0.0.3/ultralytics_thop.egg-info/PKG-INFO +0 -847
 - ultralytics_thop-0.0.3/ultralytics_thop.egg-info/requires.txt +0 -2
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/LICENSE +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/README.md +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/setup.cfg +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/tests/test_conv2d.py +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/tests/test_matmul.py +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/tests/test_relu.py +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/tests/test_utils.py +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/thop/fx_profile.py +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/thop/onnx_profile.py +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/thop/rnn_hooks.py +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/thop/utils.py +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/thop/vision/__init__.py +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/thop/vision/basic_hooks.py +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/thop/vision/calc_func.py +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/thop/vision/efficientnet.py +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/thop/vision/onnx_counter.py +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/ultralytics_thop.egg-info/dependency_links.txt +0 -0
 - {ultralytics_thop-0.0.3 → ultralytics_thop-0.2.3}/ultralytics_thop.egg-info/top_level.txt +0 -0
 
| 
         @@ -0,0 +1,188 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Metadata-Version: 2.1
         
     | 
| 
      
 2 
     | 
    
         
            +
            Name: ultralytics-thop
         
     | 
| 
      
 3 
     | 
    
         
            +
            Version: 0.2.3
         
     | 
| 
      
 4 
     | 
    
         
            +
            Summary: Ultralytics THOP package for fast computation of PyTorch model FLOPs and parameters.
         
     | 
| 
      
 5 
     | 
    
         
            +
            Author-email: Ligeng Zhu <ligeng.zhu+github@gmail.com>
         
     | 
| 
      
 6 
     | 
    
         
            +
            Maintainer: Glenn Jocher
         
     | 
| 
      
 7 
     | 
    
         
            +
            License: AGPL-3.0
         
     | 
| 
      
 8 
     | 
    
         
            +
            Project-URL: Bug Reports, https://github.com/ultralytics/thop/issues
         
     | 
| 
      
 9 
     | 
    
         
            +
            Project-URL: Funding, https://ultralytics.com
         
     | 
| 
      
 10 
     | 
    
         
            +
            Project-URL: Source, https://github.com/ultralytics/thop/
         
     | 
| 
      
 11 
     | 
    
         
            +
            Keywords: FLOPs,PyTorch,Model Analysis
         
     | 
| 
      
 12 
     | 
    
         
            +
            Classifier: Development Status :: 4 - Beta
         
     | 
| 
      
 13 
     | 
    
         
            +
            Classifier: Intended Audience :: Developers
         
     | 
| 
      
 14 
     | 
    
         
            +
            Classifier: Intended Audience :: Education
         
     | 
| 
      
 15 
     | 
    
         
            +
            Classifier: Intended Audience :: Science/Research
         
     | 
| 
      
 16 
     | 
    
         
            +
            Classifier: License :: OSI Approved :: MIT License
         
     | 
| 
      
 17 
     | 
    
         
            +
            Classifier: Programming Language :: Python :: 3
         
     | 
| 
      
 18 
     | 
    
         
            +
            Classifier: Programming Language :: Python :: 3.8
         
     | 
| 
      
 19 
     | 
    
         
            +
            Classifier: Programming Language :: Python :: 3.9
         
     | 
| 
      
 20 
     | 
    
         
            +
            Classifier: Programming Language :: Python :: 3.10
         
     | 
| 
      
 21 
     | 
    
         
            +
            Classifier: Programming Language :: Python :: 3.11
         
     | 
| 
      
 22 
     | 
    
         
            +
            Classifier: Programming Language :: Python :: 3.12
         
     | 
| 
      
 23 
     | 
    
         
            +
            Classifier: Topic :: Software Development
         
     | 
| 
      
 24 
     | 
    
         
            +
            Classifier: Topic :: Scientific/Engineering
         
     | 
| 
      
 25 
     | 
    
         
            +
            Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
         
     | 
| 
      
 26 
     | 
    
         
            +
            Classifier: Operating System :: POSIX :: Linux
         
     | 
| 
      
 27 
     | 
    
         
            +
            Classifier: Operating System :: MacOS
         
     | 
| 
      
 28 
     | 
    
         
            +
            Classifier: Operating System :: Microsoft :: Windows
         
     | 
| 
      
 29 
     | 
    
         
            +
            Requires-Python: >=3.8
         
     | 
| 
      
 30 
     | 
    
         
            +
            Description-Content-Type: text/markdown
         
     | 
| 
      
 31 
     | 
    
         
            +
            License-File: LICENSE
         
     | 
| 
      
 32 
     | 
    
         
            +
            Requires-Dist: numpy
         
     | 
| 
      
 33 
     | 
    
         
            +
            Requires-Dist: torch
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            <br>
         
     | 
| 
      
 36 
     | 
    
         
            +
            <img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320">
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            # 🚀 THOP: PyTorch-OpCounter
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            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.
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            [](https://github.com/ultralytics/thop/actions/workflows/main.yml) [](https://badge.fury.io/py/ultralytics-thop) <a href="https://ultralytics.com/discord"><img alt="Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a>
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            ## 📄 Description
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            THOP offers an intuitive API to profile PyTorch models by calculating the number of MACs and parameters. This functionality is crucial for assessing the computational efficiency and memory footprint of deep learning models.
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            ## 📦 Installation
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            You can install THOP via pip:
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 53 
     | 
    
         
            +
            pip install ultralytics-thop
         
     | 
| 
      
 54 
     | 
    
         
            +
            ```
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            Alternatively, install the latest version directly from GitHub:
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 59 
     | 
    
         
            +
            pip install --upgrade git+https://github.com/ultralytics/thop.git
         
     | 
| 
      
 60 
     | 
    
         
            +
            ```
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
            ## 🛠 How to Use
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            ### Basic Usage
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
            To profile a model, you can use the following example:
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            ```python
         
     | 
| 
      
 69 
     | 
    
         
            +
            from torchvision.models import resnet50
         
     | 
| 
      
 70 
     | 
    
         
            +
            from thop import profile
         
     | 
| 
      
 71 
     | 
    
         
            +
            import torch
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
            model = resnet50()
         
     | 
| 
      
 74 
     | 
    
         
            +
            input = torch.randn(1, 3, 224, 224)
         
     | 
| 
      
 75 
     | 
    
         
            +
            macs, params = profile(model, inputs=(input, ))
         
     | 
| 
      
 76 
     | 
    
         
            +
            ```
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
            ### Define Custom Rules for Third-Party Modules
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
            You can define custom rules for unsupported modules:
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            ```python
         
     | 
| 
      
 83 
     | 
    
         
            +
            import torch.nn as nn
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            class YourModule(nn.Module):
         
     | 
| 
      
 86 
     | 
    
         
            +
                # your definition
         
     | 
| 
      
 87 
     | 
    
         
            +
                pass
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            def count_your_model(model, x, y):
         
     | 
| 
      
 90 
     | 
    
         
            +
                # your rule here
         
     | 
| 
      
 91 
     | 
    
         
            +
                pass
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
            input = torch.randn(1, 3, 224, 224)
         
     | 
| 
      
 94 
     | 
    
         
            +
            macs, params = profile(model, inputs=(input, ), custom_ops={YourModule: count_your_model})
         
     | 
| 
      
 95 
     | 
    
         
            +
            ```
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
            ### Improve Output Readability
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
            Use `thop.clever_format` for a more readable output:
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
            ```python
         
     | 
| 
      
 102 
     | 
    
         
            +
            from thop import clever_format
         
     | 
| 
      
 103 
     | 
    
         
            +
            macs, params = clever_format([macs, params], "%.3f")
         
     | 
| 
      
 104 
     | 
    
         
            +
            ```
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
            ## 📊 Results of Recent Models
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
            The following table presents the parameters and MACs for popular models. These results can be reproduced using the script `benchmark/evaluate_famous_models.py`.
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
            <table align="center">
         
     | 
| 
      
 111 
     | 
    
         
            +
            <tr>
         
     | 
| 
      
 112 
     | 
    
         
            +
            <td>
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
            | Model            | Params(M) | MACs(G) |
         
     | 
| 
      
 115 
     | 
    
         
            +
            | ---------------- | --------- | ------- |
         
     | 
| 
      
 116 
     | 
    
         
            +
            | alexnet          | 61.10     | 0.77    |
         
     | 
| 
      
 117 
     | 
    
         
            +
            | vgg11            | 132.86    | 7.74    |
         
     | 
| 
      
 118 
     | 
    
         
            +
            | vgg11_bn         | 132.87    | 7.77    |
         
     | 
| 
      
 119 
     | 
    
         
            +
            | vgg13            | 133.05    | 11.44   |
         
     | 
| 
      
 120 
     | 
    
         
            +
            | vgg13_bn         | 133.05    | 11.49   |
         
     | 
| 
      
 121 
     | 
    
         
            +
            | vgg16            | 138.36    | 15.61   |
         
     | 
| 
      
 122 
     | 
    
         
            +
            | vgg16_bn         | 138.37    | 15.66   |
         
     | 
| 
      
 123 
     | 
    
         
            +
            | vgg19            | 143.67    | 19.77   |
         
     | 
| 
      
 124 
     | 
    
         
            +
            | vgg19_bn         | 143.68    | 19.83   |
         
     | 
| 
      
 125 
     | 
    
         
            +
            | resnet18         | 11.69     | 1.82    |
         
     | 
| 
      
 126 
     | 
    
         
            +
            | resnet34         | 21.80     | 3.68    |
         
     | 
| 
      
 127 
     | 
    
         
            +
            | resnet50         | 25.56     | 4.14    |
         
     | 
| 
      
 128 
     | 
    
         
            +
            | resnet101        | 44.55     | 7.87    |
         
     | 
| 
      
 129 
     | 
    
         
            +
            | resnet152        | 60.19     | 11.61   |
         
     | 
| 
      
 130 
     | 
    
         
            +
            | wide_resnet101_2 | 126.89    | 22.84   |
         
     | 
| 
      
 131 
     | 
    
         
            +
            | wide_resnet50_2  | 68.88     | 11.46   |
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
            </td>
         
     | 
| 
      
 134 
     | 
    
         
            +
            <td>
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
            | Model              | Params(M) | MACs(G) |
         
     | 
| 
      
 137 
     | 
    
         
            +
            | ------------------ | --------- | ------- |
         
     | 
| 
      
 138 
     | 
    
         
            +
            | resnext50_32x4d    | 25.03     | 4.29    |
         
     | 
| 
      
 139 
     | 
    
         
            +
            | resnext101_32x8d   | 88.79     | 16.54   |
         
     | 
| 
      
 140 
     | 
    
         
            +
            | densenet121        | 7.98      | 2.90    |
         
     | 
| 
      
 141 
     | 
    
         
            +
            | densenet161        | 28.68     | 7.85    |
         
     | 
| 
      
 142 
     | 
    
         
            +
            | densenet169        | 14.15     | 3.44    |
         
     | 
| 
      
 143 
     | 
    
         
            +
            | densenet201        | 20.01     | 4.39    |
         
     | 
| 
      
 144 
     | 
    
         
            +
            | squeezenet1_0      | 1.25      | 0.82    |
         
     | 
| 
      
 145 
     | 
    
         
            +
            | squeezenet1_1      | 1.24      | 0.35    |
         
     | 
| 
      
 146 
     | 
    
         
            +
            | mnasnet0_5         | 2.22      | 0.14    |
         
     | 
| 
      
 147 
     | 
    
         
            +
            | mnasnet0_75        | 3.17      | 0.24    |
         
     | 
| 
      
 148 
     | 
    
         
            +
            | mnasnet1_0         | 4.38      | 0.34    |
         
     | 
| 
      
 149 
     | 
    
         
            +
            | mnasnet1_3         | 6.28      | 0.53    |
         
     | 
| 
      
 150 
     | 
    
         
            +
            | mobilenet_v2       | 3.50      | 0.33    |
         
     | 
| 
      
 151 
     | 
    
         
            +
            | shufflenet_v2_x0_5 | 1.37      | 0.05    |
         
     | 
| 
      
 152 
     | 
    
         
            +
            | shufflenet_v2_x1_0 | 2.28      | 0.15    |
         
     | 
| 
      
 153 
     | 
    
         
            +
            | shufflenet_v2_x1_5 | 3.50      | 0.31    |
         
     | 
| 
      
 154 
     | 
    
         
            +
            | shufflenet_v2_x2_0 | 7.39      | 0.60    |
         
     | 
| 
      
 155 
     | 
    
         
            +
            | inception_v3       | 27.16     | 5.75    |
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
            </td>
         
     | 
| 
      
 158 
     | 
    
         
            +
            </tr>
         
     | 
| 
      
 159 
     | 
    
         
            +
            </table>
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
            ## 💡 Contribute
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
            We welcome community contributions to enhance THOP. Please check our [Contributing Guide](https://docs.ultralytics.com/help/contributing) for more details. Your feedback and suggestions are highly appreciated!
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
            ## 📄 License
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
            THOP is licensed under the AGPL-3.0 License. For more information, see the [LICENSE](https://github.com/ultralytics/thop/blob/master/LICENSE) file.
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
            ## 📮 Contact
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
      
 171 
     | 
    
         
            +
            For bugs or feature requests, please open an issue on [GitHub Issues](https://github.com/ultralytics/thop/issues). Join our community on [Discord](https://ultralytics.com/discord) for discussions and support.
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
            <br>
         
     | 
| 
      
 174 
     | 
    
         
            +
            <div align="center">
         
     | 
| 
      
 175 
     | 
    
         
            +
              <a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="3%" alt="Ultralytics GitHub"></a>
         
     | 
| 
      
 176 
     | 
    
         
            +
              <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
         
     | 
| 
      
 177 
     | 
    
         
            +
              <a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="3%" alt="Ultralytics LinkedIn"></a>
         
     | 
| 
      
 178 
     | 
    
         
            +
              <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
         
     | 
| 
      
 179 
     | 
    
         
            +
              <a href="https://twitter.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="3%" alt="Ultralytics Twitter"></a>
         
     | 
| 
      
 180 
     | 
    
         
            +
              <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
         
     | 
| 
      
 181 
     | 
    
         
            +
              <a href="https://youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="3%" alt="Ultralytics YouTube"></a>
         
     | 
| 
      
 182 
     | 
    
         
            +
              <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
         
     | 
| 
      
 183 
     | 
    
         
            +
              <a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="3%" alt="Ultralytics TikTok"></a>
         
     | 
| 
      
 184 
     | 
    
         
            +
              <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
         
     | 
| 
      
 185 
     | 
    
         
            +
              <a href="https://www.instagram.com/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-instagram.png" width="3%" alt="Ultralytics Instagram"></a>
         
     | 
| 
      
 186 
     | 
    
         
            +
              <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
         
     | 
| 
      
 187 
     | 
    
         
            +
              <a href="https://ultralytics.com/discord"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="3%" alt="Ultralytics Discord"></a>
         
     | 
| 
      
 188 
     | 
    
         
            +
            </div>
         
     | 
| 
         @@ -25,17 +25,17 @@ build-backend = "setuptools.build_meta" 
     | 
|
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
            [project]
         
     | 
| 
       27 
27 
     | 
    
         
             
            name = "ultralytics-thop"
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
            description = " 
     | 
| 
      
 28 
     | 
    
         
            +
            dynamic = ["version"]
         
     | 
| 
      
 29 
     | 
    
         
            +
            description = "Ultralytics THOP package for fast computation of PyTorch model FLOPs and parameters."
         
     | 
| 
       30 
30 
     | 
    
         
             
            readme = "README.md"
         
     | 
| 
       31 
31 
     | 
    
         
             
            requires-python = ">=3.8"
         
     | 
| 
       32 
     | 
    
         
            -
            license = {  
     | 
| 
      
 32 
     | 
    
         
            +
            license = { "text" = "AGPL-3.0" }
         
     | 
| 
       33 
33 
     | 
    
         
             
            keywords = ["FLOPs", "PyTorch", "Model Analysis"]  # Optional
         
     | 
| 
       34 
34 
     | 
    
         
             
            authors = [
         
     | 
| 
       35 
35 
     | 
    
         
             
                { name = "Ligeng Zhu", email = "ligeng.zhu+github@gmail.com" }
         
     | 
| 
       36 
36 
     | 
    
         
             
            ]
         
     | 
| 
       37 
37 
     | 
    
         
             
            maintainers = [
         
     | 
| 
       38 
     | 
    
         
            -
                { name = " 
     | 
| 
      
 38 
     | 
    
         
            +
                { name = "Glenn Jocher" },
         
     | 
| 
       39 
39 
     | 
    
         
             
            ]
         
     | 
| 
       40 
40 
     | 
    
         
             
            classifiers = [
         
     | 
| 
       41 
41 
     | 
    
         
             
                "Development Status :: 4 - Beta",
         
     | 
| 
         @@ -57,15 +57,14 @@ classifiers = [ 
     | 
|
| 
       57 
57 
     | 
    
         
             
                "Operating System :: Microsoft :: Windows",
         
     | 
| 
       58 
58 
     | 
    
         
             
            ]
         
     | 
| 
       59 
59 
     | 
    
         
             
            dependencies = [
         
     | 
| 
       60 
     | 
    
         
            -
                " 
     | 
| 
      
 60 
     | 
    
         
            +
                "numpy",
         
     | 
| 
       61 
61 
     | 
    
         
             
                "torch",
         
     | 
| 
       62 
62 
     | 
    
         
             
            ]
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
64 
     | 
    
         
             
            [project.urls]
         
     | 
| 
       65 
     | 
    
         
            -
            " 
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
            package-data = { "thop" = ["__version__.py"] }
         
     | 
| 
      
 65 
     | 
    
         
            +
            "Bug Reports" = "https://github.com/ultralytics/thop/issues"
         
     | 
| 
      
 66 
     | 
    
         
            +
            "Funding" = "https://ultralytics.com"
         
     | 
| 
      
 67 
     | 
    
         
            +
            "Source" = "https://github.com/ultralytics/thop/"
         
     | 
| 
       69 
68 
     | 
    
         | 
| 
       70 
69 
     | 
    
         
             
            [tool.setuptools.dynamic]
         
     | 
| 
       71 
     | 
    
         
            -
            version = { attr = "thop.__version__ 
     | 
| 
      
 70 
     | 
    
         
            +
            version = { attr = "thop.__version__" }
         
     | 
| 
         @@ -1,5 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            from packaging.version import Version
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
1 
     | 
    
         
             
            from thop.rnn_hooks import *
         
     | 
| 
       4 
2 
     | 
    
         
             
            from thop.vision.basic_hooks import *
         
     | 
| 
       5 
3 
     | 
    
         | 
| 
         @@ -7,11 +5,6 @@ from thop.vision.basic_hooks import * 
     | 
|
| 
       7 
5 
     | 
    
         
             
            # logger.setLevel(logging.INFO)
         
     | 
| 
       8 
6 
     | 
    
         
             
            from .utils import prGreen, prRed, prYellow
         
     | 
| 
       9 
7 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
            if Version(torch.__version__) < Version("1.0.0"):
         
     | 
| 
       11 
     | 
    
         
            -
                logging.warning(
         
     | 
| 
       12 
     | 
    
         
            -
                    "You are using an old version PyTorch {version}, which THOP does NOT support.".format(version=torch.__version__)
         
     | 
| 
       13 
     | 
    
         
            -
                )
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
8 
     | 
    
         
             
            default_dtype = torch.float64
         
     | 
| 
       16 
9 
     | 
    
         | 
| 
       17 
10 
     | 
    
         
             
            register_hooks = {
         
     | 
| 
         @@ -59,11 +52,9 @@ register_hooks = { 
     | 
|
| 
       59 
52 
     | 
    
         
             
                nn.LSTM: count_lstm,
         
     | 
| 
       60 
53 
     | 
    
         
             
                nn.Sequential: zero_ops,
         
     | 
| 
       61 
54 
     | 
    
         
             
                nn.PixelShuffle: zero_ops,
         
     | 
| 
      
 55 
     | 
    
         
            +
                nn.SyncBatchNorm: count_normalization,
         
     | 
| 
       62 
56 
     | 
    
         
             
            }
         
     | 
| 
       63 
57 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
            if Version(torch.__version__) >= Version("1.1.0"):
         
     | 
| 
       65 
     | 
    
         
            -
                register_hooks.update({nn.SyncBatchNorm: count_normalization})
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
58 
     | 
    
         | 
| 
       68 
59 
     | 
    
         
             
            def profile_origin(model, inputs, custom_ops=None, verbose=True, report_missing=False):
         
     | 
| 
       69 
60 
     | 
    
         
             
                """Profiles a PyTorch model's operations and parameters by applying custom or default hooks and returns total
         
     | 
| 
         @@ -98,14 +89,14 @@ def profile_origin(model, inputs, custom_ops=None, verbose=True, report_missing= 
     | 
|
| 
       98 
89 
     | 
    
         
             
                    if m_type in custom_ops:  # if defined both op maps, use custom_ops to overwrite.
         
     | 
| 
       99 
90 
     | 
    
         
             
                        fn = custom_ops[m_type]
         
     | 
| 
       100 
91 
     | 
    
         
             
                        if m_type not in types_collection and verbose:
         
     | 
| 
       101 
     | 
    
         
            -
                            print("[INFO] Customize rule  
     | 
| 
      
 92 
     | 
    
         
            +
                            print(f"[INFO] Customize rule {fn.__qualname__}() {m_type}.")
         
     | 
| 
       102 
93 
     | 
    
         
             
                    elif m_type in register_hooks:
         
     | 
| 
       103 
94 
     | 
    
         
             
                        fn = register_hooks[m_type]
         
     | 
| 
       104 
95 
     | 
    
         
             
                        if m_type not in types_collection and verbose:
         
     | 
| 
       105 
     | 
    
         
            -
                            print("[INFO] Register  
     | 
| 
      
 96 
     | 
    
         
            +
                            print(f"[INFO] Register {fn.__qualname__}() for {m_type}.")
         
     | 
| 
       106 
97 
     | 
    
         
             
                    else:
         
     | 
| 
       107 
98 
     | 
    
         
             
                        if m_type not in types_collection and report_missing:
         
     | 
| 
       108 
     | 
    
         
            -
                            prRed("[WARN] Cannot find rule for  
     | 
| 
      
 99 
     | 
    
         
            +
                            prRed(f"[WARN] Cannot find rule for {m_type}. Treat it as zero Macs and zero Params.")
         
     | 
| 
       109 
100 
     | 
    
         | 
| 
       110 
101 
     | 
    
         
             
                    if fn is not None:
         
     | 
| 
       111 
102 
     | 
    
         
             
                        handler = m.register_forward_hook(fn)
         
     | 
| 
         @@ -179,14 +170,14 @@ def profile( 
     | 
|
| 
       179 
170 
     | 
    
         
             
                        # if defined both op maps, use custom_ops to overwrite.
         
     | 
| 
       180 
171 
     | 
    
         
             
                        fn = custom_ops[m_type]
         
     | 
| 
       181 
172 
     | 
    
         
             
                        if m_type not in types_collection and verbose:
         
     | 
| 
       182 
     | 
    
         
            -
                            print("[INFO] Customize rule  
     | 
| 
      
 173 
     | 
    
         
            +
                            print(f"[INFO] Customize rule {fn.__qualname__}() {m_type}.")
         
     | 
| 
       183 
174 
     | 
    
         
             
                    elif m_type in register_hooks:
         
     | 
| 
       184 
175 
     | 
    
         
             
                        fn = register_hooks[m_type]
         
     | 
| 
       185 
176 
     | 
    
         
             
                        if m_type not in types_collection and verbose:
         
     | 
| 
       186 
     | 
    
         
            -
                            print("[INFO] Register  
     | 
| 
      
 177 
     | 
    
         
            +
                            print(f"[INFO] Register {fn.__qualname__}() for {m_type}.")
         
     | 
| 
       187 
178 
     | 
    
         
             
                    else:
         
     | 
| 
       188 
179 
     | 
    
         
             
                        if m_type not in types_collection and report_missing:
         
     | 
| 
       189 
     | 
    
         
            -
                            prRed("[WARN] Cannot find rule for  
     | 
| 
      
 180 
     | 
    
         
            +
                            prRed(f"[WARN] Cannot find rule for {m_type}. Treat it as zero Macs and zero Params.")
         
     | 
| 
       190 
181 
     | 
    
         | 
| 
       191 
182 
     | 
    
         
             
                    if fn is not None:
         
     | 
| 
       192 
183 
     | 
    
         
             
                        handler_collection[m] = (
         
     | 
| 
         @@ -0,0 +1,188 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Metadata-Version: 2.1
         
     | 
| 
      
 2 
     | 
    
         
            +
            Name: ultralytics-thop
         
     | 
| 
      
 3 
     | 
    
         
            +
            Version: 0.2.3
         
     | 
| 
      
 4 
     | 
    
         
            +
            Summary: Ultralytics THOP package for fast computation of PyTorch model FLOPs and parameters.
         
     | 
| 
      
 5 
     | 
    
         
            +
            Author-email: Ligeng Zhu <ligeng.zhu+github@gmail.com>
         
     | 
| 
      
 6 
     | 
    
         
            +
            Maintainer: Glenn Jocher
         
     | 
| 
      
 7 
     | 
    
         
            +
            License: AGPL-3.0
         
     | 
| 
      
 8 
     | 
    
         
            +
            Project-URL: Bug Reports, https://github.com/ultralytics/thop/issues
         
     | 
| 
      
 9 
     | 
    
         
            +
            Project-URL: Funding, https://ultralytics.com
         
     | 
| 
      
 10 
     | 
    
         
            +
            Project-URL: Source, https://github.com/ultralytics/thop/
         
     | 
| 
      
 11 
     | 
    
         
            +
            Keywords: FLOPs,PyTorch,Model Analysis
         
     | 
| 
      
 12 
     | 
    
         
            +
            Classifier: Development Status :: 4 - Beta
         
     | 
| 
      
 13 
     | 
    
         
            +
            Classifier: Intended Audience :: Developers
         
     | 
| 
      
 14 
     | 
    
         
            +
            Classifier: Intended Audience :: Education
         
     | 
| 
      
 15 
     | 
    
         
            +
            Classifier: Intended Audience :: Science/Research
         
     | 
| 
      
 16 
     | 
    
         
            +
            Classifier: License :: OSI Approved :: MIT License
         
     | 
| 
      
 17 
     | 
    
         
            +
            Classifier: Programming Language :: Python :: 3
         
     | 
| 
      
 18 
     | 
    
         
            +
            Classifier: Programming Language :: Python :: 3.8
         
     | 
| 
      
 19 
     | 
    
         
            +
            Classifier: Programming Language :: Python :: 3.9
         
     | 
| 
      
 20 
     | 
    
         
            +
            Classifier: Programming Language :: Python :: 3.10
         
     | 
| 
      
 21 
     | 
    
         
            +
            Classifier: Programming Language :: Python :: 3.11
         
     | 
| 
      
 22 
     | 
    
         
            +
            Classifier: Programming Language :: Python :: 3.12
         
     | 
| 
      
 23 
     | 
    
         
            +
            Classifier: Topic :: Software Development
         
     | 
| 
      
 24 
     | 
    
         
            +
            Classifier: Topic :: Scientific/Engineering
         
     | 
| 
      
 25 
     | 
    
         
            +
            Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
         
     | 
| 
      
 26 
     | 
    
         
            +
            Classifier: Operating System :: POSIX :: Linux
         
     | 
| 
      
 27 
     | 
    
         
            +
            Classifier: Operating System :: MacOS
         
     | 
| 
      
 28 
     | 
    
         
            +
            Classifier: Operating System :: Microsoft :: Windows
         
     | 
| 
      
 29 
     | 
    
         
            +
            Requires-Python: >=3.8
         
     | 
| 
      
 30 
     | 
    
         
            +
            Description-Content-Type: text/markdown
         
     | 
| 
      
 31 
     | 
    
         
            +
            License-File: LICENSE
         
     | 
| 
      
 32 
     | 
    
         
            +
            Requires-Dist: numpy
         
     | 
| 
      
 33 
     | 
    
         
            +
            Requires-Dist: torch
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            <br>
         
     | 
| 
      
 36 
     | 
    
         
            +
            <img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320">
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            # 🚀 THOP: PyTorch-OpCounter
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            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.
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            [](https://github.com/ultralytics/thop/actions/workflows/main.yml) [](https://badge.fury.io/py/ultralytics-thop) <a href="https://ultralytics.com/discord"><img alt="Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a>
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            ## 📄 Description
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            THOP offers an intuitive API to profile PyTorch models by calculating the number of MACs and parameters. This functionality is crucial for assessing the computational efficiency and memory footprint of deep learning models.
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            ## 📦 Installation
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            You can install THOP via pip:
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 53 
     | 
    
         
            +
            pip install ultralytics-thop
         
     | 
| 
      
 54 
     | 
    
         
            +
            ```
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            Alternatively, install the latest version directly from GitHub:
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 59 
     | 
    
         
            +
            pip install --upgrade git+https://github.com/ultralytics/thop.git
         
     | 
| 
      
 60 
     | 
    
         
            +
            ```
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
            ## 🛠 How to Use
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            ### Basic Usage
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
            To profile a model, you can use the following example:
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            ```python
         
     | 
| 
      
 69 
     | 
    
         
            +
            from torchvision.models import resnet50
         
     | 
| 
      
 70 
     | 
    
         
            +
            from thop import profile
         
     | 
| 
      
 71 
     | 
    
         
            +
            import torch
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
            model = resnet50()
         
     | 
| 
      
 74 
     | 
    
         
            +
            input = torch.randn(1, 3, 224, 224)
         
     | 
| 
      
 75 
     | 
    
         
            +
            macs, params = profile(model, inputs=(input, ))
         
     | 
| 
      
 76 
     | 
    
         
            +
            ```
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
            ### Define Custom Rules for Third-Party Modules
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
            You can define custom rules for unsupported modules:
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            ```python
         
     | 
| 
      
 83 
     | 
    
         
            +
            import torch.nn as nn
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            class YourModule(nn.Module):
         
     | 
| 
      
 86 
     | 
    
         
            +
                # your definition
         
     | 
| 
      
 87 
     | 
    
         
            +
                pass
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            def count_your_model(model, x, y):
         
     | 
| 
      
 90 
     | 
    
         
            +
                # your rule here
         
     | 
| 
      
 91 
     | 
    
         
            +
                pass
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
            input = torch.randn(1, 3, 224, 224)
         
     | 
| 
      
 94 
     | 
    
         
            +
            macs, params = profile(model, inputs=(input, ), custom_ops={YourModule: count_your_model})
         
     | 
| 
      
 95 
     | 
    
         
            +
            ```
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
            ### Improve Output Readability
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
            Use `thop.clever_format` for a more readable output:
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
            ```python
         
     | 
| 
      
 102 
     | 
    
         
            +
            from thop import clever_format
         
     | 
| 
      
 103 
     | 
    
         
            +
            macs, params = clever_format([macs, params], "%.3f")
         
     | 
| 
      
 104 
     | 
    
         
            +
            ```
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
            ## 📊 Results of Recent Models
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
            The following table presents the parameters and MACs for popular models. These results can be reproduced using the script `benchmark/evaluate_famous_models.py`.
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
            <table align="center">
         
     | 
| 
      
 111 
     | 
    
         
            +
            <tr>
         
     | 
| 
      
 112 
     | 
    
         
            +
            <td>
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
            | Model            | Params(M) | MACs(G) |
         
     | 
| 
      
 115 
     | 
    
         
            +
            | ---------------- | --------- | ------- |
         
     | 
| 
      
 116 
     | 
    
         
            +
            | alexnet          | 61.10     | 0.77    |
         
     | 
| 
      
 117 
     | 
    
         
            +
            | vgg11            | 132.86    | 7.74    |
         
     | 
| 
      
 118 
     | 
    
         
            +
            | vgg11_bn         | 132.87    | 7.77    |
         
     | 
| 
      
 119 
     | 
    
         
            +
            | vgg13            | 133.05    | 11.44   |
         
     | 
| 
      
 120 
     | 
    
         
            +
            | vgg13_bn         | 133.05    | 11.49   |
         
     | 
| 
      
 121 
     | 
    
         
            +
            | vgg16            | 138.36    | 15.61   |
         
     | 
| 
      
 122 
     | 
    
         
            +
            | vgg16_bn         | 138.37    | 15.66   |
         
     | 
| 
      
 123 
     | 
    
         
            +
            | vgg19            | 143.67    | 19.77   |
         
     | 
| 
      
 124 
     | 
    
         
            +
            | vgg19_bn         | 143.68    | 19.83   |
         
     | 
| 
      
 125 
     | 
    
         
            +
            | resnet18         | 11.69     | 1.82    |
         
     | 
| 
      
 126 
     | 
    
         
            +
            | resnet34         | 21.80     | 3.68    |
         
     | 
| 
      
 127 
     | 
    
         
            +
            | resnet50         | 25.56     | 4.14    |
         
     | 
| 
      
 128 
     | 
    
         
            +
            | resnet101        | 44.55     | 7.87    |
         
     | 
| 
      
 129 
     | 
    
         
            +
            | resnet152        | 60.19     | 11.61   |
         
     | 
| 
      
 130 
     | 
    
         
            +
            | wide_resnet101_2 | 126.89    | 22.84   |
         
     | 
| 
      
 131 
     | 
    
         
            +
            | wide_resnet50_2  | 68.88     | 11.46   |
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
            </td>
         
     | 
| 
      
 134 
     | 
    
         
            +
            <td>
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
            | Model              | Params(M) | MACs(G) |
         
     | 
| 
      
 137 
     | 
    
         
            +
            | ------------------ | --------- | ------- |
         
     | 
| 
      
 138 
     | 
    
         
            +
            | resnext50_32x4d    | 25.03     | 4.29    |
         
     | 
| 
      
 139 
     | 
    
         
            +
            | resnext101_32x8d   | 88.79     | 16.54   |
         
     | 
| 
      
 140 
     | 
    
         
            +
            | densenet121        | 7.98      | 2.90    |
         
     | 
| 
      
 141 
     | 
    
         
            +
            | densenet161        | 28.68     | 7.85    |
         
     | 
| 
      
 142 
     | 
    
         
            +
            | densenet169        | 14.15     | 3.44    |
         
     | 
| 
      
 143 
     | 
    
         
            +
            | densenet201        | 20.01     | 4.39    |
         
     | 
| 
      
 144 
     | 
    
         
            +
            | squeezenet1_0      | 1.25      | 0.82    |
         
     | 
| 
      
 145 
     | 
    
         
            +
            | squeezenet1_1      | 1.24      | 0.35    |
         
     | 
| 
      
 146 
     | 
    
         
            +
            | mnasnet0_5         | 2.22      | 0.14    |
         
     | 
| 
      
 147 
     | 
    
         
            +
            | mnasnet0_75        | 3.17      | 0.24    |
         
     | 
| 
      
 148 
     | 
    
         
            +
            | mnasnet1_0         | 4.38      | 0.34    |
         
     | 
| 
      
 149 
     | 
    
         
            +
            | mnasnet1_3         | 6.28      | 0.53    |
         
     | 
| 
      
 150 
     | 
    
         
            +
            | mobilenet_v2       | 3.50      | 0.33    |
         
     | 
| 
      
 151 
     | 
    
         
            +
            | shufflenet_v2_x0_5 | 1.37      | 0.05    |
         
     | 
| 
      
 152 
     | 
    
         
            +
            | shufflenet_v2_x1_0 | 2.28      | 0.15    |
         
     | 
| 
      
 153 
     | 
    
         
            +
            | shufflenet_v2_x1_5 | 3.50      | 0.31    |
         
     | 
| 
      
 154 
     | 
    
         
            +
            | shufflenet_v2_x2_0 | 7.39      | 0.60    |
         
     | 
| 
      
 155 
     | 
    
         
            +
            | inception_v3       | 27.16     | 5.75    |
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
            </td>
         
     | 
| 
      
 158 
     | 
    
         
            +
            </tr>
         
     | 
| 
      
 159 
     | 
    
         
            +
            </table>
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
            ## 💡 Contribute
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
            We welcome community contributions to enhance THOP. Please check our [Contributing Guide](https://docs.ultralytics.com/help/contributing) for more details. Your feedback and suggestions are highly appreciated!
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
            ## 📄 License
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
            THOP is licensed under the AGPL-3.0 License. For more information, see the [LICENSE](https://github.com/ultralytics/thop/blob/master/LICENSE) file.
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
            ## 📮 Contact
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
      
 171 
     | 
    
         
            +
            For bugs or feature requests, please open an issue on [GitHub Issues](https://github.com/ultralytics/thop/issues). Join our community on [Discord](https://ultralytics.com/discord) for discussions and support.
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
            <br>
         
     | 
| 
      
 174 
     | 
    
         
            +
            <div align="center">
         
     | 
| 
      
 175 
     | 
    
         
            +
              <a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="3%" alt="Ultralytics GitHub"></a>
         
     | 
| 
      
 176 
     | 
    
         
            +
              <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
         
     | 
| 
      
 177 
     | 
    
         
            +
              <a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="3%" alt="Ultralytics LinkedIn"></a>
         
     | 
| 
      
 178 
     | 
    
         
            +
              <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
         
     | 
| 
      
 179 
     | 
    
         
            +
              <a href="https://twitter.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="3%" alt="Ultralytics Twitter"></a>
         
     | 
| 
      
 180 
     | 
    
         
            +
              <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
         
     | 
| 
      
 181 
     | 
    
         
            +
              <a href="https://youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="3%" alt="Ultralytics YouTube"></a>
         
     | 
| 
      
 182 
     | 
    
         
            +
              <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
         
     | 
| 
      
 183 
     | 
    
         
            +
              <a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="3%" alt="Ultralytics TikTok"></a>
         
     | 
| 
      
 184 
     | 
    
         
            +
              <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
         
     | 
| 
      
 185 
     | 
    
         
            +
              <a href="https://www.instagram.com/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-instagram.png" width="3%" alt="Ultralytics Instagram"></a>
         
     | 
| 
      
 186 
     | 
    
         
            +
              <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
         
     | 
| 
      
 187 
     | 
    
         
            +
              <a href="https://ultralytics.com/discord"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="3%" alt="Ultralytics Discord"></a>
         
     | 
| 
      
 188 
     | 
    
         
            +
            </div>
         
     |