ultralytics-thop 0.2.8__py3-none-any.whl → 2.0.0__py3-none-any.whl
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.
- thop/__init__.py +1 -1
 - thop/fx_profile.py +3 -4
 - thop/vision/basic_hooks.py +1 -8
 - {ultralytics_thop-0.2.8.dist-info → ultralytics_thop-2.0.0.dist-info}/METADATA +1 -1
 - ultralytics_thop-2.0.0.dist-info/RECORD +13 -0
 - ultralytics_thop-0.2.8.dist-info/RECORD +0 -13
 - {ultralytics_thop-0.2.8.dist-info → ultralytics_thop-2.0.0.dist-info}/LICENSE +0 -0
 - {ultralytics_thop-0.2.8.dist-info → ultralytics_thop-2.0.0.dist-info}/WHEEL +0 -0
 - {ultralytics_thop-0.2.8.dist-info → ultralytics_thop-2.0.0.dist-info}/top_level.txt +0 -0
 
    
        thop/__init__.py
    CHANGED
    
    
    
        thop/fx_profile.py
    CHANGED
    
    | 
         @@ -33,10 +33,10 @@ def count_matmul(input_shapes, output_shapes): 
     | 
|
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
            def count_fn_linear(input_shapes, output_shapes, *args, **kwargs):
         
     | 
| 
       35 
35 
     | 
    
         
             
                """Calculates total operations (FLOPs) for a linear layer given input and output shapes."""
         
     | 
| 
       36 
     | 
    
         
            -
                 
     | 
| 
      
 36 
     | 
    
         
            +
                flops = count_matmul(input_shapes, output_shapes)
         
     | 
| 
       37 
37 
     | 
    
         
             
                if "bias" in kwargs:
         
     | 
| 
       38 
     | 
    
         
            -
                     
     | 
| 
       39 
     | 
    
         
            -
                return  
     | 
| 
      
 38 
     | 
    
         
            +
                    flops += output_shapes[0].numel()
         
     | 
| 
      
 39 
     | 
    
         
            +
                return flops
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
            from .vision.calc_func import calculate_conv
         
     | 
| 
         @@ -131,7 +131,6 @@ def fx_profile(mod: nn.Module, input: th.Tensor, verbose=False): 
     | 
|
| 
       131 
131 
     | 
    
         
             
                information if verbose.
         
     | 
| 
       132 
132 
     | 
    
         
             
                """
         
     | 
| 
       133 
133 
     | 
    
         
             
                gm: torch.fx.GraphModule = symbolic_trace(mod)
         
     | 
| 
       134 
     | 
    
         
            -
                g = gm.graph
         
     | 
| 
       135 
134 
     | 
    
         
             
                ShapeProp(gm).propagate(input)
         
     | 
| 
       136 
135 
     | 
    
         | 
| 
       137 
136 
     | 
    
         
             
                fprint = null_print
         
     | 
    
        thop/vision/basic_hooks.py
    CHANGED
    
    | 
         @@ -10,7 +10,6 @@ multiply_adds = 1 
     | 
|
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
            def count_parameters(m, x, y):
         
     | 
| 
       12 
12 
     | 
    
         
             
                """Calculate and update the total number of parameters in a given PyTorch model."""
         
     | 
| 
       13 
     | 
    
         
            -
                total_params = sum(torch.DoubleTensor([p.numel()]) for p in m.parameters())
         
     | 
| 
       14 
13 
     | 
    
         
             
                m.total_params[0] = calculate_parameters(m.parameters())
         
     | 
| 
       15 
14 
     | 
    
         | 
| 
       16 
15 
     | 
    
         | 
| 
         @@ -22,10 +21,7 @@ def zero_ops(m, x, y): 
     | 
|
| 
       22 
21 
     | 
    
         
             
            def count_convNd(m: _ConvNd, x, y: torch.Tensor):
         
     | 
| 
       23 
22 
     | 
    
         
             
                """Calculate and add the number of convolutional operations (FLOPs) to the model's total operations count."""
         
     | 
| 
       24 
23 
     | 
    
         
             
                x = x[0]
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                kernel_ops = torch.zeros(m.weight.size()[2:]).numel()  # Kw x Kh
         
     | 
| 
       27 
     | 
    
         
            -
                bias_ops = 1 if m.bias is not None else 0
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 24 
     | 
    
         
            +
                
         
     | 
| 
       29 
25 
     | 
    
         
             
                m.total_ops += calculate_conv2d_flops(
         
     | 
| 
       30 
26 
     | 
    
         
             
                    input_size=list(x.shape),
         
     | 
| 
       31 
27 
     | 
    
         
             
                    output_size=list(y.shape),
         
     | 
| 
         @@ -95,9 +91,6 @@ def count_prelu(m, x, y): 
     | 
|
| 
       95 
91 
     | 
    
         
             
            def count_relu(m, x, y):
         
     | 
| 
       96 
92 
     | 
    
         
             
                """Calculate and update the total operation counts for a ReLU layer."""
         
     | 
| 
       97 
93 
     | 
    
         
             
                x = x[0]
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
                nelements = x.numel()
         
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
94 
     | 
    
         
             
                m.total_ops += calculate_relu_flops(list(x.shape))
         
     | 
| 
       102 
95 
     | 
    
         | 
| 
       103 
96 
     | 
    
         | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            thop/__init__.py,sha256=atkwStCUTA2zIEim2pGqbVkiIS0T_lSE1d7ajoxa2fA,146
         
     | 
| 
      
 2 
     | 
    
         
            +
            thop/fx_profile.py,sha256=NDObo07yrBf7B6ENltPMR9Cr1IolEumRkeTI6pXhpVs,8210
         
     | 
| 
      
 3 
     | 
    
         
            +
            thop/profile.py,sha256=z89mX1zVr_42axKbhgz9k2MJbgBLaBPt30lYT_PcWuA,7848
         
     | 
| 
      
 4 
     | 
    
         
            +
            thop/rnn_hooks.py,sha256=GYuKaNPEdZzTuqNCrJpTBjeQHsWs65UXCCaViS2giik,6485
         
     | 
| 
      
 5 
     | 
    
         
            +
            thop/utils.py,sha256=V_Pj_qC6RjqMyuiSX05eeUujT07hZQV-xobCIabjDds,1422
         
     | 
| 
      
 6 
     | 
    
         
            +
            thop/vision/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         
     | 
| 
      
 7 
     | 
    
         
            +
            thop/vision/basic_hooks.py,sha256=oOuHk5iPjRJjUuijY8Zppqr1s1abKV0y08N4DuqZGVg,4619
         
     | 
| 
      
 8 
     | 
    
         
            +
            thop/vision/calc_func.py,sha256=RE-qQWGjZIlRx8CNKjF-ZY7aS0WShPkvnOAYvQA8z8I,4130
         
     | 
| 
      
 9 
     | 
    
         
            +
            ultralytics_thop-2.0.0.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
         
     | 
| 
      
 10 
     | 
    
         
            +
            ultralytics_thop-2.0.0.dist-info/METADATA,sha256=JdsrGLxGdfqT1xnZsmaz5ejScJG5ALlTVjE4jNqwxQs,8525
         
     | 
| 
      
 11 
     | 
    
         
            +
            ultralytics_thop-2.0.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
         
     | 
| 
      
 12 
     | 
    
         
            +
            ultralytics_thop-2.0.0.dist-info/top_level.txt,sha256=HQ7D0gSvDJ31CNR-f0EuXNVve05RYBmwyIkHQKiEhU8,5
         
     | 
| 
      
 13 
     | 
    
         
            +
            ultralytics_thop-2.0.0.dist-info/RECORD,,
         
     | 
| 
         @@ -1,13 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            thop/__init__.py,sha256=nRitFGQJlu5vCs1JrMHYbmf8_rIcIfJ6ujcV9--_dOM,146
         
     | 
| 
       2 
     | 
    
         
            -
            thop/fx_profile.py,sha256=DSC3phrsDj08tey_OYVeiL6A8q3BE1er2YjH8W60VrM,8238
         
     | 
| 
       3 
     | 
    
         
            -
            thop/profile.py,sha256=z89mX1zVr_42axKbhgz9k2MJbgBLaBPt30lYT_PcWuA,7848
         
     | 
| 
       4 
     | 
    
         
            -
            thop/rnn_hooks.py,sha256=GYuKaNPEdZzTuqNCrJpTBjeQHsWs65UXCCaViS2giik,6485
         
     | 
| 
       5 
     | 
    
         
            -
            thop/utils.py,sha256=V_Pj_qC6RjqMyuiSX05eeUujT07hZQV-xobCIabjDds,1422
         
     | 
| 
       6 
     | 
    
         
            -
            thop/vision/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         
     | 
| 
       7 
     | 
    
         
            -
            thop/vision/basic_hooks.py,sha256=i_CSCC0o5olEbK2hOirehDKfD8ae19IjCkyHk0Zr4ko,4839
         
     | 
| 
       8 
     | 
    
         
            -
            thop/vision/calc_func.py,sha256=RE-qQWGjZIlRx8CNKjF-ZY7aS0WShPkvnOAYvQA8z8I,4130
         
     | 
| 
       9 
     | 
    
         
            -
            ultralytics_thop-0.2.8.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
         
     | 
| 
       10 
     | 
    
         
            -
            ultralytics_thop-0.2.8.dist-info/METADATA,sha256=rIGQaLv_zrB6KB-qd35Z9L8igXLHf6xab4McW8d-Yhk,8525
         
     | 
| 
       11 
     | 
    
         
            -
            ultralytics_thop-0.2.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
         
     | 
| 
       12 
     | 
    
         
            -
            ultralytics_thop-0.2.8.dist-info/top_level.txt,sha256=HQ7D0gSvDJ31CNR-f0EuXNVve05RYBmwyIkHQKiEhU8,5
         
     | 
| 
       13 
     | 
    
         
            -
            ultralytics_thop-0.2.8.dist-info/RECORD,,
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     |