kymatio icon indicating copy to clipboard operation
kymatio copied to clipboard

JTFS produces a non-contiguous tensor with `swap_time_frequency`

Open cyrusvahidi opened this issue 2 years ago • 9 comments

In the implementation of JTFS, we introduced a new backend primitive named swap_time_frequency. This conveniently tranposes the time and frequency axes such that we can perform scattering along the frequency axis. However, Kymatio has implemented contiguity checks (for reasons that I am unaware of) that are checked when performing complex modulus and other operators.

JTFS torch currently hits a runtime error due to non-contiguous tensors that appear to be induced by swap_time_frequency before frequential scattering.

I opened PR https://github.com/kymatio/kymatio/pull/972 which simply forced the tensor returned by swap_time_frequency to be contiguous. This may be inefficient, since it clones the tensor.

This poses the following questions:

  • why did we need contiguous tensors in the first place?
  • can we copy the tensor and force contiguity?
  • is there a more efficient approach?

cyrusvahidi avatar Nov 02 '22 12:11 cyrusvahidi