code: def test_while_example():
      def body(a, b):
          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))
  
      logger.info("prog:\n" + str(prog))
  
      mlmodel = ct.convert(
          prog, source="milinternal", convert_to="neuralnetwork"
      )
  
      feed_dict = {
          "a": np.random.rand(1, 2).astype(np.float32),
          "b": np.random.rand(1, 2).astype(np.float32),
      }
      assert mlmodel is not None
  
      if ct.utils._is_macos():
          prediction = mlmodel.predict(feed_dict)
          assert len(prediction) == 2
  
imports: import numpy
  import pytest
  import coremltools
  from coremltools import _logger
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Function, Program, types
  from coremltools.converters.mil.mil.passes.tests.test_passes import CONSTEXPR_FUNCS
label_desc: Use image node_id 3 for calling a global function with example usage: test_while_example() and returns: mb,  b, mb, mb