The parameters of the fully connected layer in the loss function are normalized in the following way:
for W in self.fc.parameters():
W = F.normalize(W, p=2, dim=1)
However, the weights of self.fc are not effected from this operation, I checked it with print(self.fc.weight) and print(W). This means that the cosine calculation is actually conducted with non-normalized vectors.
Hello!
The parameters of the fully connected layer in the loss function are normalized in the following way:
However, the weights of
self.fc
are not effected from this operation, I checked it withprint(self.fc.weight)
andprint(W)
. This means that the cosine calculation is actually conducted with non-normalized vectors.