Why does torch.fft.irfftn give radically different results than np.fft.irfftn?

import torch
import torch.fft
x_start = torch.randn(1,3,224,224, 2)
x_pt = torch.view_as_complex(x_start)
x_pt = torch.fft.irfftn(x_pt, s=(224,224))

import numpy as np
x_np = x_start.numpy()
x_np = np.fft.irfftn(x_np, s=(224,224)).real

print(torch.as_tensor(x_np).float().sum(), x_pt.sum())

The above code shows what I mean. From my understanding both the NumPy and PyTorch code do the exact same thing, but give different results.

Figured it out!

This line causes the PyTorch version to be different:

x_pt = torch.view_as_complex(x_start)