-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Closed
Labels
module: complexRelated to complex number support in PyTorchRelated to complex number support in PyTorchmodule: docsRelated to our documentation, both in docs/ and docblocksRelated to our documentation, both in docs/ and docblockstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
>>> abs_t = torch.tensor([-1., 2, -3])
>>> angle_t = torch.randn(3)
>>> torch.polar(abs_t, angle_t)
tensor([-0.7947-0.6070j, 1.2734-1.5422j, -2.6964+1.3151j])It should error out if abs<0.
We should add checks in the following kernel
pytorch/aten/src/ATen/native/cpu/ComplexKernel.cpp
Lines 20 to 22 in bb34fd6
| cpu_kernel(iter, [=](scalar_t a, scalar_t b) -> c10::complex<scalar_t> { | |
| return c10::complex<scalar_t>(a * std::cos(b), a * std::sin(b)); | |
| }); |
pytorch/aten/src/ATen/native/cuda/ComplexKernel.cu
Lines 25 to 26 in 22a34bc
| iter, [] GPU_LAMBDA(scalar_t a, scalar_t b) -> c10::complex<scalar_t> { | |
| return c10::complex<scalar_t>(a * std::cos(b), a * std::sin(b)); |
anjali411
Metadata
Metadata
Assignees
Labels
module: complexRelated to complex number support in PyTorchRelated to complex number support in PyTorchmodule: docsRelated to our documentation, both in docs/ and docblocksRelated to our documentation, both in docs/ and docblockstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module