Solved by Bled_Clement in post #4 
              
              
                Apologies for not coming back to this thread. If I recall correctly, in the end, the problem was not with rfft() but with my multiplication operation. 
I analyzed my tensors and found that after this operation, NaNs were present. This was because I was trying to multiply by zero. To get around this,…