You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- visual transformers from [timm](https://github.com/huggingface/pytorch-image-models)
24
39
25
-
Requirements: Pytorch >= 1.1, torchvision >= 0.3
26
-
27
-
Thanks to @warmspringwinds for the initial version of script.
28
-
29
-
## Usage tips
40
+
### Usage tips
30
41
31
-
- This tool doesn't take into account some of the `torch.nn.functional.*` and `tensor.*` operations. Therefore unsupported operations are
42
+
- This backend doesn't take into account some of the `torch.nn.functional.*` and `tensor.*` operations. Therefore unsupported operations are
32
43
not contributing to the final complexity estimation. See `ptflops/pytorch_ops.py:FUNCTIONAL_MAPPING,TENSOR_OPS_MAPPING` to check supported ops.
33
44
-`ptflops` launches a given model on a random tensor and estimates amount of computations during inference. Complicated models can have several inputs, some of them could be optional. To construct non-trivial input one can use the `input_constructor` argument of the `get_model_complexity_info`. `input_constructor` is a function that takes the input spatial resolution as a tuple and returns a dict with named input arguments of the model. Next this dict would be passed to the model as a keyword arguments.
34
45
-`verbose` parameter allows to get information about modules that don't contribute to the final numbers.
35
46
-`ignore_modules` option forces `ptflops` to ignore the listed modules. This can be useful
36
47
for research purposes. For instance, one can drop all convolutions from the counting process
37
48
specifying `ignore_modules=[torch.nn.Conv2d]`.
38
49
50
+
Requirements: Pytorch >= 1.1, torchvision >= 0.3
51
+
52
+
Thanks to @warmspringwinds and Horace He for the initial version of the script.
53
+
39
54
## Install the latest version
40
55
From PyPI:
41
56
```bash
@@ -55,7 +70,12 @@ from ptflops import get_model_complexity_info
0 commit comments