I think broadcasting might work:
x = torch.arange(10).view(-1, 1).expand(10, 2) x[:, 0] - x[:, 1].view(-1, 1)