Closed lylyhan closed 1 year ago
Thanks for reporting. I tried to reproduce the error but couldn't. The following snippet works for me with latest version of PyTorch/Functorch. Which version are you using?
import torch
import functorch
sig = torch.rand(2**13)
def stft_forward(sig):
return torch.stft(sig, n_fft=2048, return_complex=True).flatten() # return_complex=True is required for real inputs
J = functorch.jacfwd(stft_forward)(sig)
thanks for your reply. My functorch and torch versions are the following:
>>> functorch.__version__
'0.2.1'
>>> torch.__version__
'1.12.1'
Which version did you use that avoided this error?
Thanks for confirming @lylyhan ! It works for me with 1.13.0
.
NOTE: With 1.13
, you don't need to install functorch
separately as it is already bundled with PyTorch.
Closing as fixed, but please let us know if you're still experiencing the problem on a newer version of pytorch/functorch.
Hello, I am trying to derive the jacobian matrix of a short time fourier transform operation (via torch.stft) with respect to an input signal. the code i used was
yet the following error message is triggered:
Would people know what aspect of the torch.stft operation caused this gradient shape incompatibility issue and how one may work around this? thanks in advance!