examples/pytorch/speech-pretraining/run_wav2vec2_pretraining_no_trainer.py/multiply_grads
def multiply_grads(params, c):
    """Multiplies grads by a constant *c*."""
    for p in params:
        if p.grad is not None:
            if torch.is_tensor(c):
                c = c.to(p.grad.device)
            p.grad.data.mul_(c)