code: def _verify_output_correctness_of_chunks(
      full_model,
      first_chunk_model=None,
      second_chunk_model=None,
      pipeline_model=None,
  ):
      """Verifies the end-to-end output correctness of full (original) model versus chunked models"""
      # Generate inputs for first chunk and full model
      input_dict = {}
      for input_desc in full_model._spec.description.input:
          input_dict[input_desc.name] = random_gen_input_feature_type(
              input_desc
          )
  
      # Generate outputs for full model
      outputs_from_full_model = full_model.predict(input_dict)
  
      if pipeline_model is not None:
          outputs_from_pipeline_model = pipeline_model.predict(
              input_dict
          )
          final_outputs = outputs_from_pipeline_model
  
      elif (
          first_chunk_model is not None
          and second_chunk_model is not None
      ):
          # Generate outputs for first chunk
          outputs_from_first_chunk_model = first_chunk_model.predict(
              input_dict
          )
  
          # Prepare inputs for second chunk model from first chunk's outputs and regular inputs
          second_chunk_input_dict = {}
          for input_desc in second_chunk_model._spec.description.input:
              if input_desc.name in outputs_from_first_chunk_model:
                  second_chunk_input_dict[
                      input_desc.name
                  ] = outputs_from_first_chunk_model[input_desc.name]
              else:
                  second_chunk_input_dict[input_desc.name] = input_dict[
                      input_desc.name
                  ]
  
          # Generate output for second chunk model
          outputs_from_second_chunk_model = second_chunk_model.predict(
              second_chunk_input_dict
          )
          final_outputs = outputs_from_second_chunk_model
      else:
          raise ValueError
  
      # Verify correctness across all outputs from second chunk and full model
      for out_name in outputs_from_full_model.keys():
          torch2coreml.report_correctness(
              original_outputs=outputs_from_full_model[out_name],
              final_outputs=final_outputs[out_name],
              log_prefix=f"{out_name}",
          )
  
imports: import argparse
  from collections import OrderedDict
  import coremltools
  from coremltools.converters.mil import Block, Program, Var
  from coremltools.converters.mil.frontend.milproto.load import load
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Placeholder
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.passes.helper import block_context_manager
  from coremltools.converters.mil.mil.passes.pass_registry import PASS_REGISTRY
  from coremltools.converters.mil.testing_utils import random_gen_input_feature_type
  import gc
  import logging
  import numpy
  import os
  from python_coreml_stable_diffusion import torch2coreml
  import shutil
  import time
label_desc: Use image node_id 1 for calling a global function with example usage: _verify_output_correctness_of_chunks(full_model, first_chunk_model, second_chunk_model, pipeline_model) without return types