Open zhangtemplar opened 4 years ago
This should fix it:
for _, module in self.fc.named_modules():
if isinstance(module, nn.Linear):
module.weight.data = F.normalize(module.weight, p=2, dim=1)
This should fix it:
for _, module in self.fc.named_modules(): if isinstance(module, nn.Linear): module.weight.data = F.normalize(module.weight, p=2, dim=1)
thanks
I find this problem, too. I modify it like this:
self.fc.weight.data = F.normalize(self.fc.weight.data, p=2, dim=1)
@cvqluu can you fix it in the code? thanks
I tested it and the normalization will not working: