(config)
| 93 | |
| 94 | |
| 95 | def build_criterion(config): |
| 96 | if config.AUG.MIXUP > 0.: |
| 97 | # smoothing is handled with mixup label transform |
| 98 | criterion = SoftTargetCrossEntropy() |
| 99 | elif config.MODEL.LABEL_SMOOTHING > 0.: |
| 100 | criterion = LabelSmoothingCrossEntropy( |
| 101 | smoothing=config.MODEL.LABEL_SMOOTHING) |
| 102 | else: |
| 103 | criterion = torch.nn.CrossEntropyLoss() |
| 104 | return criterion |
| 105 | |
| 106 | |
| 107 | def scale_learning_rate(config, num_processes): |