import torch


def Dist(sample, adv, ordr=float('inf')):
    """Computes the norm of the difference between two vectors. The operation is done for batches of vectors
    sample: pytorch tensor with dimensions [batch, others]
    adv: pytorch tensor with the same dimensions as 'sample'
    ordr: order of the norm. Must be in {1,2,float('inf')}
    outputs -> pytorch tensor of dimensions [batch] containing distance values for the batch of samples.
    """
    sus = sample - adv
    sus = sus.view(sus.shape[0], -1)
    return torch.norm(sus, ordr, 1)