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