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))
  
      logging.info("prog:\n", prog)
  
      proto = converter._convert(
          prog, convert_from="mil", convert_to="nn_proto"
      )
  
      feed_dict = {
          "a": np.random.rand(1, 2).astype(np.float32),
          "b": np.random.rand(1, 2).astype(np.float32),
      }
      model = models.MLModel(proto)
      assert model is not None
  
      if ct.utils._is_macos():
          prediction = model.predict(feed_dict)
          assert len(prediction) == 2
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/mil/tests/test_programs.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import pytest
  import coremltools
  from coremltools import models
  import numpy
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil import converter
  import logging
label_desc: Use image node_id 3 for calling a global function with example usage: test_while_example() and returns: mb,  b, mb, mb