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
RuntimeError: diag does not support automatic differentiation for outputs with complex dtype. #48490
Comments
Hey @rjkilpatrick! Thanks for reporting this issue. We would accept a PR adding this support. |
@rjkilpatrick @mruberry, Looks like
|
@Rajathbharadwaj, torch.diag was implemented for complex double in #47564. I will attempt a PR over the weekend. |
Oh okay. Can either one be deprecated? Since both are essentially doing the same thing, and I found it confusing. |
No, we cannot deprecate them. They're different functions and NumPy also has both: https://numpy.org/doc/stable/reference/generated/numpy.diag.html?highlight=diag#numpy.diag Their names could probably be clearer, but one extracts a diagonal and the other creates a matrix with the given the diagonal. |
@rjkilpatrick @mruberry I also want to work on this, any pointers on how I can get started? |
|
Issue no longer present on nightly (1.11.0.dev20210926) |
馃悰 Bug
Autograd doesn't work for
torch.diag
for complex dtypes.To Reproduce
Steps to reproduce the behavior:
Same holds for
torch.diagflat
.Expected behaviour
Gradient operator of effective reshape operator.
i.e. equivalent to:
Environment
PyTorch version: 1.8.0.dev20201124
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: Microsoft Windows 10 Enterprise
GCC version: Could not collect
Clang version: Could not collect
CMake version: Could not collect
Python version: 3.8 (64-bit runtime)
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A MIOpen runtime version: N/A
Versions of relevant libraries:
[pip3] numpy==1.19.2
[pip3] torch==1.8.0.dev20201124
[pip3] torchaudio==0.8.0.dev20201124
[pip3] torchvision==0.9.0.dev20201124
[conda] blas 1.0 mkl
[conda] cpuonly 1.0 0 pytorch-nightly
[conda] mkl 2020.2 256
[conda] mkl-service 2.3.0 py38h2bbff1b_0
[conda] mkl_fft 1.2.0 py38h45dec08_0
[conda] mkl_random 1.1.1 py38h47e9c7a_0
[conda] numpy 1.19.2 py38hadc3359_0
[conda] numpy-base 1.19.2 py38ha3acd2a_0
[conda] pytorch 1.8.0.dev20201124 py3.8_cpu_0 [cpuonly] pytorch-nightly
[conda] torchaudio 0.8.0.dev20201124 py38 pytorch-nightly [conda] torchvision 0.9.0.dev20201124 py38_cpu [cpuonly] pytorch-nightly
Additional context
The text was updated successfully, but these errors were encountered: