-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Norm of complex Tensor #50972
Comments
@HamedHojatian |
replica of #47833 (comment) @HamedHojatian this was fixed in #48284 and works on the latest master and will be added in the 1.8 release. let us know if you run into any issues with this function on the latest master. thanks!! |
cc @kurtamohler, this is fixed, right? Thank you for reporting this issue, @HamedHojatian. We've been updating torch.norm's complex behavior recently, and in PyTorch 1.7 there's the NumPy-compatible torch.linalg.norm, I'm surprised this worked in PyTorch 1.6. The tensor provided in the snippet is only 1D, and the frobenius norm only operates on matrices. I don't think the 2-norm support complex inputs, either, in PyTorch 1.6. What did this produce in PyTorch 1.6? |
Great! thank you ! Is cuda supporting it? |
Thank you. As I check, the norm function is working correctly in 2D at 1.6. |
Interesting. Good thing it's fixed in PyTorch 1.8! Thanks for following up, @HamedHojatian! |
According to https://mathworld.wolfram.com/L2-Norm.html and numpy, the order 2 norm of a complex vector is
This is what numpy gives, disagreeing with pytorch 1.6.
And in pytorch 1.6, other vector norms calculate the absolute value of elements first with
Pytorch 1.8 updates |
You are right. It is wrong. Thank you ! |
馃悰 Bug
The norm function (torch.norm) doesn't work on the complex tensor in the pytorch version 1.7.1 . However, in version 1.6.0, it works.
To Reproduce
Steps to reproduce the behavior:
torch.norm(torch.tensor([1+1j, 2+2j]))
Environment
cc @ezyang @anjali411 @dylanbespalko @mruberry @jianyuh @nikitaved @pearu @heitorschueroff @walterddr @IvanYashchuk
The text was updated successfully, but these errors were encountered: