class_docstr: Perform the body repeatedly while the condition ``cond`` is true.
  
  Parameters
  ----------
  _cond: function  (Required)
      * A Python function that takes ``loop_vars`` as positional arguments.
      * The function must return a ``bool`` ``Var``.
  
  _body: function  (Required)
      * A Python function that takes ``loop_vars`` as positional arguments.
      * The function must return the same number of output vars as ``loop_vars``
        with the same types.
  
  loop_vars: tuple (Required)
      * Python tuple of ``Variables``.
  
  _existing_blocks: list[Block] (Optional)
      * Python list of ``Block``.
      * For internal use only. When converting a milproto, we already got existing blocks,
        and the ``build_nested_blocks`` function can use them directly.
      * When ``_existing_blocks`` is set, ``_cond`` and ``_body`` must be dummy functions which returns ``None``.
  
  Returns
  -------
  tuple
      * Python tuple (same type as ``loop_vars``).
class_docstr_tok: ["Perform","the","body","repeatedly","while","the","condition","``","cond","``","is","true",".","Parameters","--","--","--","--","--","_cond",":","function","(","Required",")","*","A","Python","function","that","takes","``","loop_vars","``","as","positional","arguments",".","*","The","function","must","return","a","``","bool","``","``","Var","``",".","_body",":","function","(","Required",")","*","A","Python","function","that","takes","``","loop_vars","``","as","positional","arguments",".","*","The","function","must","return","the","same","number","of","output","vars","as","``","loop_vars","``","with","the","same","types",".","loop_vars",":","tuple","(","Required",")","*","Python","tuple","of","``","Variables","``",".","_existing_blocks",":","list","[","Block","]","(","Optional",")","*","Python","list","of","``","Block","``",".","*","For","internal","use","only",".","When","converting","a","milproto",",","we","already","got","existing","blocks",",","and","the","``","build_nested_blocks","``","function","can","use","them","directly",".","*","When","``","_existing_blocks","``","is","set",",","``","_cond","``","and","``","_body","``","must","be","dummy","functions","which","returns","``","None","``",".","Returns","--","--","--","-","tuple","*","Python","tuple","(","same","type","as","``","loop_vars","``",")","."]
code: def _build_block(self, block_inputs):
      # Cond block:
      block_name = self.name + "_cond_block"
      with Block(
          block_inputs=block_inputs, outer_op=self, name=block_name
      ) as cond_block:
          cond_func = self._cond.val
          cond_var = cond_func(*cond_block.inputs)
          cond_vars = (
              cond_var if isinstance(cond_var, list) else [cond_var]
          )
          cond_block.set_outputs(cond_vars)
  
      # Body block
      block_name = self.name + "_body_block"
      with Block(
          block_inputs=block_inputs, outer_op=self, name=block_name
      ) as body_block:
          body_func = self._body.val
          exit_vars = body_func(*body_block.inputs)
          exit_vars = (
              list(exit_vars)
              if isinstance(exit_vars, (list, tuple))
              else [exit_vars]
          )
          body_block.set_outputs(exit_vars)
  
      return cond_block, body_block, exit_vars
  
imports: import copy
  import numpy
  from coremltools import _logger
  from coremltools.converters.mil.mil import Block, get_existing_symbol, get_new_symbol, types
  from coremltools.converters.mil.mil.input_type import DefaultInputs, InputSpec, InternalInputType, ListInputType, PyFunctionInputType, TensorInputType, TupleInputType
  from coremltools.converters.mil.mil.operation import NONE, SYMBOL, VALUE, Operation, mil_list, precondition
  from coremltools.converters.mil.mil.ops.defs._op_reqs import register_op
  from coremltools.converters.mil.mil.ops.defs._utils import infer_type_with_broadcast, promoted_primitive_type
  from coremltools.converters.mil.mil.types import is_compatible_type
  from coremltools.converters.mil.mil.types.type_list import list
  from coremltools.converters.mil.mil.types.type_mapping import builtin_to_string, is_subtype, numpy_type_to_builtin_type, numpy_val_to_builtin_val
label_desc: Use image node_id 3 for calling the while_loop obj's underlying member method code with example usage: obj._build_block(block_inputs) and returns: cond_block,  body_block,  exit_vars