Computes and stores the average and current value
| 46 | logger.setLevel(logging.DEBUG) |
| 47 | |
| 48 | class AverageMeter(object): |
| 49 | """Computes and stores the average and current value""" |
| 50 | def __init__(self): |
| 51 | self.reset() |
| 52 | |
| 53 | def reset(self): |
| 54 | self.val = 0 |
| 55 | self.avg = 0 |
| 56 | self.sum = 0 |
| 57 | self.count = 0 |
| 58 | |
| 59 | def update(self, val, n=1): |
| 60 | self.val = val |
| 61 | self.sum += val * n |
| 62 | self.count += n |
| 63 | self.avg = self.sum / self.count |
| 64 | |
| 65 | class Knowledge_Distillation_Loss(torch.nn.Module): |
| 66 | def __init__(self, scale, T = 3): |
no outgoing calls
no test coverage detected