Also adding my implementation for the ftt and ifft functions (since they also a part of the forward and backward):
        ############dft/idtf####################
        norm_factor_over = self.pad_cnt + 1
        dft_mat = scipy.linalg.dft(self.fft_size_pad_nn)
        ########################################
        ############idft mat####################
        idft_mat = np.conj(dft_mat)  # conjugate
        idft_mat = (1 / self.fft_size_pad_nn) * norm_factor_over * idft_mat
        idft_re = np.real(idft_mat)
        idft_im = np.imag(idft_mat)
        idft_block = np.block([[idft_re, -idft_im], [idft_im, idft_re]]).astype(np.float32)
        self.idft_block_torch = torch.from_numpy(idft_block).to(device)

        ###########dft mat#######################
        dft_mat_norm = (1/norm_factor_over) * dft_mat
        dft_re = np.real(dft_mat_norm)
        dft_im = np.imag(dft_mat_norm)
        dft_block = np.block([[dft_re, -dft_im], [dft_im, dft_re]]).astype(np.float32)
        self.dft_block_torch = torch.from_numpy(dft_block).to(device)

def ifft_calc(x, fft_size, idft_block_torch):
    x_t_mat = x
    even_number = torch.arange(0, 2 * fft_size, 2)
    odd_number = torch.arange(1, 2 * fft_size, 2)
    x_real = torch.transpose(x, 0, 1)[even_number]  
    x_imag = torch.transpose(x, 0, 1)[odd_number]
    x_k_concat = torch.cat((x_real, x_imag), 0)
    x_t = torch.matmul(idft_block_torch, x_k_concat)
    x_t_real = x_t[0:fft_size]
    x_t_imag = x_t[fft_size:2 * fft_size]
    x_t_real = torch.transpose(x_t_real, 0, 1)
    x_t_imag = torch.transpose(x_t_imag, 0, 1)
    x_t_mat[:, even_number] = x_t_real
    x_t_mat[:, odd_number] = x_t_imag
    return x_t_mat

def fft_calc(x, fft_size, dft_block_torch):
    x_k_mat = x
    even_number = torch.arange(0, 2 * fft_size, 2)
    odd_number = torch.arange(1, 2 * fft_size, 2)
    x_real = torch.transpose(x, 0, 1)[even_number] 
    x_imag = torch.transpose(x, 0, 1)[odd_number]
    x_n_concat = torch.cat((x_real, x_imag), 0)
    x_k = torch.matmul(dft_block_torch, x_n_concat)
    x_k_real = x_k[0:fft_size]
    x_k_imag = x_k[fft_size:2 * fft_size]
    x_k_real = torch.transpose(x_k_real, 0, 1)
    x_k_imag = torch.transpose(x_k_imag, 0, 1)
    x_k_mat[:, even_number] = x_k_real
    x_k_mat[:, odd_number] = x_k_imag
    return x_k_mat