code: def test_norm_rfft(self):
      inputs_val = np.random.random((1, N, N)).astype(
          pytensor.config.floatX
      )
      inputs = pytensor.shared(inputs_val)
  
      # Unitary normalization
      rfft = fft.rfft(inputs, norm="ortho")
      f_rfft = pytensor.function([], rfft)
      res_rfft = f_rfft()
      res_rfft_comp = np.asarray(
          res_rfft[:, :, :, 0]
      ) + 1j * np.asarray(res_rfft[:, :, :, 1])
  
      rfft_ref = np.fft.rfftn(inputs_val, axes=(1, 2))
  
      utt.assert_allclose(
          rfft_ref / N, res_rfft_comp, atol=1e-4, rtol=1e-4
      )
  
      # No normalization
      rfft = fft.rfft(inputs, norm="no_norm")
      f_rfft = pytensor.function([], rfft)
      res_rfft = f_rfft()
      res_rfft_comp = np.asarray(
          res_rfft[:, :, :, 0]
      ) + 1j * np.asarray(res_rfft[:, :, :, 1])
  
      utt.assert_allclose(rfft_ref, res_rfft_comp, atol=1e-4, rtol=1e-4)
  
      # Inverse FFT inputs
      inputs_val = np.random.random((1, N, N // 2 + 1, 2)).astype(
          pytensor.config.floatX
      )
      inputs = pytensor.shared(inputs_val)
      inputs_ref = inputs_val[..., 0] + 1j * inputs_val[..., 1]
  
      # Unitary normalization inverse FFT
      irfft = fft.irfft(inputs, norm="ortho")
      f_irfft = pytensor.function([], irfft)
      res_irfft = f_irfft()
  
      irfft_ref = np.fft.irfftn(inputs_ref, axes=(1, 2))
  
      utt.assert_allclose(
          irfft_ref * N, res_irfft, atol=1e-4, rtol=1e-4
      )
  
      # No normalization inverse FFT
      irfft = fft.irfft(inputs, norm="no_norm")
      f_irfft = pytensor.function([], irfft)
      res_irfft = f_irfft()
  
      utt.assert_allclose(
          irfft_ref * N**2, res_irfft, atol=1e-4, rtol=1e-4
      )
  
file_path: pytensor/tests/tensor/test_fft.py
imports: import numpy
  import pytest
  import pytensor
  from pytensor.tensor import fft
  from pytensor.tensor.type import matrix
  from tests import unittest_tools
label_desc: Use image node_id 5 for calling the TestFFT obj's underlying member method code with example usage: obj.test_norm_rfft() without return types