def _get_op_idx_split_location(prog: _mil.Program) -> _Tuple[int, int, int]:
    """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

    raise ValueError("Not able to find the bisect point in the model.")
Find the op that approximately bisects the graph as measure by weights size on each side
coremltools/models/utils.py