Perfect, I implemented it (your second strategy) and it was working fine as soon as I was having only one batch.
The problem is that I actually have a [BATCH_SIZE, 42] (intermediate) input and I was reshaping it as [21,2] when the batch was 1 without any problem, simply using something like h.view(21, 2).
How to deal with that when BATCH_SIZE is different from 1? How should I reshape it to fit the function to_polar?
Sorry for the dumb question, but I am not very familiar with these sizing issues.