def __init__(
        self,
        reference_model: MLModel,
        target_model: MLModel,
        function_name: Optional[str] = None,
        optimization_hints: Optional[Dict[str, Any]] = None,
        num_predict_intermediate_outputs: int = 20,
        reference_device: Optional[Device] = None,
        target_device: Optional[Device] = None,
    ):
        """
        Initializes the MLModelComparator.

        Parameters
        ----------
        reference_model : MLModel
             The reference MLModel.

        target_model : MLModel
            The target MLModel to compare against the reference.

        function_name : Optional[str]
            The function name. Defaults to the model's function name.

        optimization_hints : Optional[Dict[str, Any]]
            Keys are the names of the optimization hint, either 'reshapeFrequency' or 'specializationStrategy'.
            Values are enumeration values of type ``coremltools.ReshapeFrequency`` or ``coremltools.SpecializationStrategy``.

        num_predict_intermediate_outputs : int
            The number of intermediate outputs to retrieve in each ``MLModel`` prediction call. Defaults to 20.

        reference_device: Device
            The device on which the reference model will execute.

        target_device: Device
            The device on which the target model will execute.
        """

        reference_model_inspector = MLModelInspector(
            model=reference_model,
            function_name=function_name,
            optimization_hints=optimization_hints,
            device=reference_device,
        )

        target_model_inspector = MLModelInspector(
            model=target_model,
            function_name=function_name,
            optimization_hints=optimization_hints,
            device=target_device,
        )

        self.reference_model = reference_model
        self.target_model = target_model
        self._reference_model_inspector = reference_model_inspector
        self._target_model_inspector = target_model_inspector
        self._reference_output_name_to_op_map = (
            self._reference_model_inspector.output_name_to_op_map
        )
        self._target_output_names_index = _create_name_index(
            self._target_model_inspector.output_name_to_op_map.keys(),
        )
        self._reference_outputs = {}
        self._target_outputs = {}
        self._visited = set()
        self._num_predict_intermediate_outputs = num_predict_intermediate_outputs

        Initializes the MLModelComparator.

        Parameters
        ----------
        reference_model : MLModel
             The reference MLModel.

        target_model : MLModel
            The target MLModel to compare against the reference.

        function_name : Optional[str]
            The function name. Defaults to the model's function name.

        optimization_hints : Optional[Dict[str, Any]]
            Keys are the names of the optimization hint, either 'reshapeFrequency' or 'specializationStrategy'.
            Values are enumeration values of type ``coremltools.ReshapeFrequency`` or ``coremltools.SpecializationStrategy``.

        num_predict_intermediate_outputs : int
            The number of intermediate outputs to retrieve in each ``MLModel`` prediction call. Defaults to 20.

        reference_device: Device
            The device on which the reference model will execute.

        target_device: Device
            The device on which the target model will execute.
        
coremltools/models/ml_program/experimental/debugging_utils.py