Closed monajalal closed 3 years ago
fixed by this change in tripletnet.py
def forward(self, x):
x = self.fc1(x)
x = self.fc2(x)
# L2 normalize each feature vector
##norm = torch.norm(x, p=2, dim=1) + 1e-10
##x = x / norm.expand_as(x)
x = torch.nn.functional.normalize(x, p=2.0, dim=1, eps=1e-10, out=None)
return x