F.normalize(torch.nn.functional) 和 torch.norm 在维度操作方面,两者的操作一致。前者在后者求向量L2范数的基础上,增加了标准化
来源 https://blog.csdn.net/nyist_yangguang/article/details/126449306
a = image_features / image_features.norm(dim=1, keepdim=True)
b = F.normalize(image_features,dim=1)
a 和 b 相等