Solved by ptrblck in post #2 
              
              
                This code should work to compute the difference in the C dimension: 
B, C = 10, 5
x = torch.arange(B * C).view(B, C)
result = x[:, 1:]  - x[:, :-1]