(arch, dataset)
| 220 | |
| 221 | |
| 222 | def get_arch(arch, dataset): |
| 223 | if dataset == 'cifar10': |
| 224 | in_dims, out_dims = 3, 10 |
| 225 | elif dataset == 'cifar100': |
| 226 | in_dims, out_dims = 3, 100 |
| 227 | elif dataset == 'tiny-imagenet': |
| 228 | in_dims, out_dims = 3, 200 |
| 229 | elif dataset == 'imagenet': |
| 230 | in_dims, out_dims = 3, 1000 |
| 231 | elif dataset == 'imagenet-mini': |
| 232 | in_dims, out_dims = 3, 100 |
| 233 | else: |
| 234 | raise NotImplementedError('dataset {} is not supported'.format(dataset)) |
| 235 | |
| 236 | if arch == 'resnet18': |
| 237 | return models.resnet18(in_dims, out_dims) |
| 238 | |
| 239 | elif arch == 'resnet50': |
| 240 | return models.resnet50(in_dims, out_dims) |
| 241 | |
| 242 | elif arch == 'wrn-34-10': |
| 243 | return models.wrn34_10(in_dims, out_dims) |
| 244 | |
| 245 | elif arch == 'vgg11-bn': |
| 246 | if dataset == 'imagenet' or dataset == 'imagenet-mini': |
| 247 | raise NotImplementedError |
| 248 | return models.vgg11_bn(in_dims, out_dims) |
| 249 | |
| 250 | elif arch == 'vgg16-bn': |
| 251 | if dataset == 'imagenet' or dataset == 'imagenet-mini': |
| 252 | raise NotImplementedError |
| 253 | return models.vgg16_bn(in_dims, out_dims) |
| 254 | |
| 255 | elif arch == 'vgg19-bn': |
| 256 | return models.vgg19_bn(in_dims, out_dims) |
| 257 | |
| 258 | elif arch == 'densenet-121': |
| 259 | return models.densenet121(num_classes=out_dims) |
| 260 | |
| 261 | else: |
| 262 | raise NotImplementedError('architecture {} is not supported'.format(arch)) |
| 263 | |
| 264 | |
| 265 | def get_optim(optim, params, lr=0.1, weight_decay=1e-4, momentum=0.9): |
nothing calls this directly
no outgoing calls
no test coverage detected