def get_gradients(model):
    """Returns a list of average graident per learnable parameter"""

    ave_grads = []
    for p in model.named_parameters():
        if p[1].requires_grad:
            if p[1].grad is not None:
                ave_grads.append((p[0], p[1].grad.abs().mean()))
            else:
                ave_grads.append((p[0], None))

    return ave_grads