code: def test_builder_to_backend_while(self, use_cpu_only, backend):
      # The while_loop appends [1, 2]*i to `ls` for each iteration
      # i = 0, ... num_iters-1.
      def body(i, num_iters, ls, update):
          new_elem = mb.mul(x=update, y=i)
          return (
              mb.add(x=i, y=1),
              num_iters,
              mb.list_write(ls=ls, index=i, value=new_elem),
              update,
          )
  
      def cond(i, num_iters, ls, update):
          return mb.less(x=i, y=num_iters)
  
      elem_shape = (2,)
      input_placeholders = {
          "num_iters": mb.placeholder(shape=(1,)),
          "update": mb.placeholder(shape=elem_shape),
      }
  
      def build(num_iters, update):
          i = 0
          ls = mb.make_list(init_length=1, elem_shape=elem_shape)
          _, _, final_tensor_list, _ = mb.while_loop(
              _cond=cond,
              _body=body,
              loop_vars=(i, num_iters, ls, update),
          )
          list_len = mb.list_length(ls=final_tensor_list)
          indices = mb.range_1d(start=0, end=list_len, step=1)
          return mb.list_gather(ls=final_tensor_list, indices=indices)
  
      input_values = {
          "num_iters": np.array([3], dtype=np.float32),
          "update": np.array([1, 2], dtype=np.float32),
      }
  
      expected_output_types = [
          # Type inference does not unroll loop
          (UNK_SYM, 2, types.fp32),
      ]
  
      expected_outputs = [
          np.array([[0, 0], [1, 2], [2, 4]], dtype=np.float32),
      ]
      run_compare_builder(
          build,
          input_placeholders,
          input_values,
          expected_output_types,
          expected_outputs,
          use_cpu_only=use_cpu_only,
          frontend_only=False,
          backend=backend,
      )
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/mil/ops/tests/test_control_flow.py
imports: from coremltools.converters.mil import testing_reqs
  from coremltools.converters.mil.testing_reqs import *
  from .testing_utils import run_compare_builder, UNK_SYM
label_desc: Use image node_id 2 for calling the TestList obj's underlying member method code with example usage: obj.test_builder_to_backend_while(use_cpu_only, backend) and returns: mb,  num_iters,  mb,  update, mb, mb