code: def test_commingle_loop_vars():
      def body(a, b):
          # b is a loop invariant
          return mb.add(x=a, y=b), b
  
      def cond(a, b):
          a_mean = mb.reduce_mean(x=a, axes=[0, 1])
          b_mean = mb.reduce_mean(x=b, axes=[0, 1])
          return mb.less(x=a_mean, y=b_mean)
  
      @mb.program(
          input_specs=[
              mb.TensorSpec(shape=(1, 2)),
              mb.TensorSpec(shape=(1, 2)),
          ]
      )
      def prog(a, b):
          return mb.while_loop(_cond=cond, _body=body, loop_vars=(a, b))
  
      while_op = prog.find_ops(op_type="while_loop", exactly_one=True)[
          0
      ]
      assert while_op.blocks[0].inputs[0].name == "a_x0"
      assert while_op.blocks[0].inputs[1].name == "b_x0"
  
      prev_prog = copy.deepcopy(prog)
      PASS_REGISTRY["nn_backend::commingle_loop_vars"](prog)
      assert_same_output_names(prev_prog, prog)
  
      while_op = prog.find_ops(op_type="while_loop", exactly_one=True)[
          0
      ]
      assert (
          while_op.blocks[0].inputs[0].name == while_op.outputs[0].name
      )
      assert (
          while_op.blocks[0].inputs[1].name == while_op.outputs[1].name
      )
  
      prog.validate()
  
file_path: coremltools/coremltools/converters/mil/backend/nn/passes/test_passes.py
imports: import copy
  import itertools
  import numpy
  import pytest
  from coremltools.converters.mil import testing_reqs
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil.passes.pass_registry import PASS_REGISTRY
  from coremltools.converters.mil.testing_utils import apply_pass_and_basic_check, assert_model_is_valid, assert_same_output_names, get_op_types_in_program
label_desc: Use image node_id 1 for calling a global function with example usage: test_commingle_loop_vars() and returns: mb,  b, mb, mb