about code
Opened this issue · 0 comments
njnj0314 commented
Hello, I would like to ask what is the real meaning of the following code:
Is this the distance used to solve for x and y? What does it do?
def dist_mat(self,x, y, inplace=True):
d = torch.mm(x, y.transpose(0, 1))
v_x = torch.sum(x ** 2, 1).unsqueeze(1)
v_y = torch.sum(y ** 2, 1).unsqueeze(0)
d *= -2
if inplace:
d += v_x
d += v_y
else:
d = d + v_x
d = d + v_y
return d