I am trying to replicate a call to tensorflow’s real 2D inverse Fourier transform using torch.irfft. Here is the code that I am using to test:
import numpy as np
import tensorflow as tf
import torch

x = np.random.randn(2, 8, 8)

x_tf = tf.complex(x[0], x[1])
x_tf = tf.signal.irfft2d(x_tf)
print(f'Tensorflow output: {x_tf.shape}')
# Tensorflow output: (8, 14)

x_pt = torch.from_numpy(x).permute(1, 2, 0)
x_pt = torch.irfft(x_pt, signal_ndim=2)
print(f'Pytorch output: {tuple(x_pt.shape)}')
# Pytorch output: (8, 15)

What is the reason for the discrepancy in the output shape between the two libraries? Is this the expected behavior?
My pytorch version is 1.4.0 and my tensorflow version is 2.1.0.