code: def _get_op_idx_split_location(prog: Program):
      """Find the op that approximately bisects the graph as measure by weights size on each side"""
      main_block = prog.functions["main"]
      total_size_in_mb = 0
  
      for op in main_block.operations:
          if op.op_type == "const" and isinstance(
              op.val.val, np.ndarray
          ):
              size_in_mb = (
                  op.val.val.size * op.val.val.itemsize / (1024 * 1024)
              )
              total_size_in_mb += size_in_mb
      half_size = total_size_in_mb / 2
  
      # Find the first non const op (single child), where the total cumulative size exceeds
      # the half size for the first time
      cumulative_size_in_mb = 0
      for op in main_block.operations:
          if op.op_type == "const" and isinstance(
              op.val.val, np.ndarray
          ):
              size_in_mb = (
                  op.val.val.size * op.val.val.itemsize / (1024 * 1024)
              )
              cumulative_size_in_mb += size_in_mb
  
          # Note: The condition "not op.op_type.startswith("const")" is to make sure that the
          # incision op is neither of type "const" nor "constexpr_*" ops that
          # are used to store compressed weights
          if (
              cumulative_size_in_mb > half_size
              and not op.op_type.startswith("const")
              and len(op.outputs) == 1
              and len(op.outputs[0].child_ops) == 1
          ):
              op_idx = main_block.operations.index(op)
              return op_idx, cumulative_size_in_mb, total_size_in_mb
  
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 3 for calling a global function with example usage: _get_op_idx_split_location(prog) and returns: op_idx,  cumulative_size_in_mb,  total_size_in_mb