How can I do tensor add and subtract like torch.bmm?

Hello.
Suppose tensor a and b with shape NCHW, for every pixel, I want to compute the euclidean distance from every other pixel, which will produce a tensor with shape N(HW)(H*W).
If the distance is vector inner product, then torch.bmm can help me do this. However I need to compute the euclidean distance.
Thanks!