code: def _get_first_chunk_outputs(block, op_idx):
      # Get the list of all vars that go across from first program (all ops from 0 to op_idx (inclusive))
      # to the second program (all ops from op_idx+1 till the end). These all vars need to be made the output
      # of the first program and the input of the second program
      boundary_vars = set()
      for i in range(op_idx + 1):
          op = block.operations[i]
          if not op.op_type.startswith("const"):
              for var in op.outputs:
                  if var.val is None:  # only consider non const vars
                      for child_op in var.child_ops:
                          child_op_idx = block.operations.index(
                              child_op
                          )
                          if child_op_idx > op_idx:
                              boundary_vars.add(var)
      return list(boundary_vars)
  
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 4 for calling a global function with example usage: _get_first_chunk_outputs(block, op_idx) and returns: list