import torch


def loss_TV(p,q):
    """
    Total Variation loss function between two torch Tensors

    :param p: 1st tensor
    :param q: 2nd tensor
    :return: sum of the absolute differences of each component
    """
    return torch.sum(torch.abs(p-q))    # Already size-independent