code: def _restore_conj(
      input_data: ComplexVar, n: Var, dim: Var, before_op: Operation
  ) -> Tuple[Var, Var]:
      """
      The input is interpreted as a one-sided Hermitian signal in the Fourier domain, as produced
      by rfft(). So we need to restore it to the full matrix by following X[i] = conj(X[-i]).
      Real part's conj is itself, and imaginary part's conj is negative of the original value.
      For odd number n, the last element is also included in mirroring input.
      """
      real_data: Var = input_data.real
      imag_data: Var = input_data.imag
  
      size = 2 * (input_data.real.shape[dim.val] - 1)
      if n is not None and n.val is not None:
          size = n.val
          real_data = _resize_data(
              real_data,
              dims=(dim.val,),
              sizes=(size // 2 + 1,),
              before_op=before_op,
          )
          imag_data = _resize_data(
              imag_data,
              dims=(dim.val,),
              sizes=(size // 2 + 1,),
              before_op=before_op,
          )
  
      range_end = (
          real_data.shape[dim.val] - 2
          if size % 2 == 0
          else real_data.shape[dim.val] - 1
      )
      if range_end > 0:
          mirror_indices = mb.range_1d(
              start=range_end, end=0, step=-1, before_op=before_op
          )
          real_part_mirror_values = mb.gather(
              x=real_data,
              indices=mirror_indices,
              axis=dim.val,
              before_op=before_op,
          )
          imag_part_mirror_values = mb.gather(
              x=imag_data,
              indices=mirror_indices,
              axis=dim.val,
              before_op=before_op,
          )
          imag_part_mirror_values = mb.mul(
              x=imag_part_mirror_values, y=-1.0, before_op=before_op
          )
  
          real_data = mb.concat(
              values=[real_data, real_part_mirror_values],
              axis=dim.val,
              before_op=before_op,
          )
          imag_data = mb.concat(
              values=[imag_data, imag_part_mirror_values],
              axis=dim.val,
              before_op=before_op,
          )
  
      return real_data, imag_data
  
imports: import functools
  from typing import Callable, Dict, Optional, Tuple
  import numpy
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.operation import Operation
  from coremltools.converters.mil.mil.ops.defs.complex_dialect_ops import fft_canonicalize_length_dim, fft_canonicalize_shapes_dims
  from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass
  from coremltools.converters.mil.mil.passes.helper import block_context_manager
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
  from coremltools.converters.mil.mil.var import ComplexVar, Var
label_desc: Use image node_id 2 for calling a global function with example usage: _restore_conj(input_data, n, dim, before_op) and returns: real_data,  imag_data