|
1 |
| -from typing import Any |
| 1 | +from typing import Any, Optional |
2 | 2 |
|
3 | 3 | import torch
|
4 | 4 | import torch.nn as nn
|
|
12 | 12 | "QuantizableShuffleNetV2",
|
13 | 13 | "shufflenet_v2_x0_5",
|
14 | 14 | "shufflenet_v2_x1_0",
|
15 |
| - "shufflenet_v2_x1_5", |
16 |
| - "shufflenet_v2_x2_0", |
17 | 15 | ]
|
18 | 16 |
|
19 | 17 | quant_model_urls = {
|
20 |
| - "shufflenetv2_x0.5_fbgemm": None, |
| 18 | + "shufflenetv2_x0.5_fbgemm": "https://download.pytorch.org/models/quantized/shufflenetv2_x0.5_fbgemm-00845098.pth", |
21 | 19 | "shufflenetv2_x1.0_fbgemm": "https://download.pytorch.org/models/quantized/shufflenetv2_x1_fbgemm-db332c57.pth",
|
22 |
| - "shufflenetv2_x1.5_fbgemm": None, |
23 |
| - "shufflenetv2_x2.0_fbgemm": None, |
24 | 20 | }
|
25 | 21 |
|
26 | 22 |
|
@@ -96,6 +92,7 @@ def _shufflenetv2(
|
96 | 92 | assert pretrained in [True, False]
|
97 | 93 |
|
98 | 94 | if pretrained:
|
| 95 | + model_url: Optional[str] = None |
99 | 96 | if quantize:
|
100 | 97 | model_url = quant_model_urls[arch + "_" + backend]
|
101 | 98 | else:
|
@@ -147,45 +144,3 @@ def shufflenet_v2_x1_0(
|
147 | 144 | return _shufflenetv2(
|
148 | 145 | "shufflenetv2_x1.0", pretrained, progress, quantize, [4, 8, 4], [24, 116, 232, 464, 1024], **kwargs
|
149 | 146 | )
|
150 |
| - |
151 |
| - |
152 |
| -def shufflenet_v2_x1_5( |
153 |
| - pretrained: bool = False, |
154 |
| - progress: bool = True, |
155 |
| - quantize: bool = False, |
156 |
| - **kwargs: Any, |
157 |
| -) -> QuantizableShuffleNetV2: |
158 |
| - """ |
159 |
| - Constructs a ShuffleNetV2 with 1.5x output channels, as described in |
160 |
| - `"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" |
161 |
| - <https://arxiv.org/abs/1807.11164>`_. |
162 |
| -
|
163 |
| - Args: |
164 |
| - pretrained (bool): If True, returns a model pre-trained on ImageNet |
165 |
| - progress (bool): If True, displays a progress bar of the download to stderr |
166 |
| - quantize (bool): If True, return a quantized version of the model |
167 |
| - """ |
168 |
| - return _shufflenetv2( |
169 |
| - "shufflenetv2_x1.5", pretrained, progress, quantize, [4, 8, 4], [24, 176, 352, 704, 1024], **kwargs |
170 |
| - ) |
171 |
| - |
172 |
| - |
173 |
| -def shufflenet_v2_x2_0( |
174 |
| - pretrained: bool = False, |
175 |
| - progress: bool = True, |
176 |
| - quantize: bool = False, |
177 |
| - **kwargs: Any, |
178 |
| -) -> QuantizableShuffleNetV2: |
179 |
| - """ |
180 |
| - Constructs a ShuffleNetV2 with 2.0x output channels, as described in |
181 |
| - `"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" |
182 |
| - <https://arxiv.org/abs/1807.11164>`_. |
183 |
| -
|
184 |
| - Args: |
185 |
| - pretrained (bool): If True, returns a model pre-trained on ImageNet |
186 |
| - progress (bool): If True, displays a progress bar of the download to stderr |
187 |
| - quantize (bool): If True, return a quantized version of the model |
188 |
| - """ |
189 |
| - return _shufflenetv2( |
190 |
| - "shufflenetv2_x2.0", pretrained, progress, quantize, [4, 8, 4], [24, 244, 488, 976, 2048], **kwargs |
191 |
| - ) |
0 commit comments