(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8,
weight_decay=0, amsgrad=False, max_norm=None, norm_type=2)
| 6 | class AdamWithClip(Adam): |
| 7 | |
| 8 | def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8, |
| 9 | weight_decay=0, amsgrad=False, max_norm=None, norm_type=2): |
| 10 | super(AdamWithClip, self).__init__(params, lr, betas, eps, weight_decay, amsgrad) |
| 11 | self.max_norm = max_norm |
| 12 | self.norm_type = norm_type |
| 13 | |
| 14 | def step(self, closure=None): |
| 15 | if self.max_norm is not None: |