赞
踩
逆归一化的时候再把这个数乘回去就行了
magnitude = a.norm(p=2, dim=1, keepdim=True) # NEW a=torch.nn.functional.normalize(a, p=2, dim=1) a_or= a* magnitude # NEW print(a_or) Outputs: tensor([]1,2,3)