I want to calculate the differences between adjacent elements of a tensor X in 1 D.
e.g if my tensor has a dimension of BxC where B is batch size and C is a channel.
function diff(X) should outputt [X(2)-X(1) X(3)-X(2) ... X(c)-X(c-1)].
How can I do it in pytorch?