import torch


def translate_cluster(cluster, dim, amount):
    """Translates a cluster in a particular dimension by some amount
    """
    translation = torch.ones(cluster.size(0)) * amount
    cluster.transpose(0, 1)[dim].add_(translation)
    return cluster