Wraps `torchvision.models.inception_v3`
(*args, **kwargs)
| 164 | |
| 165 | |
| 166 | def _inception_v3(*args, **kwargs): |
| 167 | """Wraps `torchvision.models.inception_v3`""" |
| 168 | try: |
| 169 | version = tuple(map(int, torchvision.__version__.split('.')[:2])) |
| 170 | except ValueError: |
| 171 | # Just a caution against weird version strings |
| 172 | version = (0,) |
| 173 | |
| 174 | # Skips default weight inititialization if supported by torchvision |
| 175 | # version. See https://github.com/mseitzer/pytorch-fid/issues/28. |
| 176 | if version >= (0, 6): |
| 177 | kwargs['init_weights'] = False |
| 178 | |
| 179 | # Backwards compatibility: `weights` argument was handled by `pretrained` |
| 180 | # argument prior to version 0.13. |
| 181 | if version < (0, 13) and 'weights' in kwargs: |
| 182 | if kwargs['weights'] == 'DEFAULT': |
| 183 | kwargs['pretrained'] = True |
| 184 | elif kwargs['weights'] is None: |
| 185 | kwargs['pretrained'] = False |
| 186 | else: |
| 187 | raise ValueError( |
| 188 | 'weights=={} not supported in torchvision {}'.format( |
| 189 | kwargs['weights'], torchvision.__version__ |
| 190 | ) |
| 191 | ) |
| 192 | del kwargs['weights'] |
| 193 | |
| 194 | return torchvision.models.inception_v3(*args, **kwargs) |
| 195 | |
| 196 | |
| 197 | def fid_inception_v3(): |
no outgoing calls
no test coverage detected