After experimenting with stft and istft, I have discovered that the input rank limitation imposed by torch.stft is inconvenient.
When containing multiple channels in single waveform, the input shape might be (batch_size, num_channels, num_samples) which is not supported by torch.stft. However, this format works well with other backends.
To address this, the PR has added reshape logic for stft function in the torch backend. The rank limitation of ops.stft has now been removed.
Furthermore, I have found that torch.istft works under specific condition which is common in audio processing.
The current implementation can be summarized in the following table:
After experimenting with
stft
andistft
, I have discovered that the input rank limitation imposed bytorch.stft
is inconvenient.When containing multiple channels in single waveform, the input shape might be
(batch_size, num_channels, num_samples)
which is not supported bytorch.stft
. However, this format works well with other backends.To address this, the PR has added
reshape
logic forstft
function in the torch backend. The rank limitation ofops.stft
has now been removed.Furthermore, I have found that
torch.istft
works under specific condition which is common in audio processing.The current implementation can be summarized in the following table:
scipy.signal.stft
scipy.signal.istft
jax.scipy.signal.stft
jax.scipy.signal.istft
tf.signal.stft
tf.signal.inverse_stft
torch.stft
torch.istft
& custom implementation