Solved by ptrblck in post #2 
              
              
                You could unsqueeze the tensors and let broadcasting do its job as seen here: 
S = torch.arange(0, 5*3).view(5, 3)
P = torch.arange(1, 10*3+1).view(10, 3)

D = S.unsqueeze(0) - P.unsqueeze(1)
print(D.shape)
# > torch.Size([10, 5, 3])
print(D)