def model_norm(model, pow=(2, 1), vidx=-1):
    """norm of a model (l2 squared by default)

    Args:
        model (float tensor): scoring model
        pow (float, float): (internal power, external power)
        vidx (int): video index if only one is computed (-1 for all)

    Returns:
        (float scalar tensor): norm of the model
    """
    q, p = pow
    if vidx != -1:  # if we use only one video
        return abs(model[vidx]) ** (q * p)
    return (model ** q).abs().sum() ** p