def adjust_learning_rate_by_lars(args, global_lr, para):
    """Adjust the learning rate via Layer-Wise Adaptive Rate Scaling (LARS)
    """
    lr = global_lr

    if args.lr_lars:
        local_lr = args.lr_lars_eta * para.data.norm() / para.grad.data.norm()
        if args.lr_lars_mode == 'clip':
            lr = min(local_lr, lr)
        elif args.lr_lars_mode == 'scale':
            lr = local_lr * lr
        else:
            raise ValueError('Invalid LARS mode: %s' % args.lr_lars_factor)
    return lr