code: def while_loop(cond, loop_vars, loop_bodies):
      """
      Construct a while loop.
  
      Parameters
      ----------
  
      cond: Callable[Tuple[relay.Expr], relay.Expr]
          The condition of the loop.
  
      loop_vars:  Tuple[relay.Expr]
          The variables being looped over.
          The initial values of the loop, will be used to
          construct the loop variables.
  
      loop_bodies: Callable[Tuple[relay.Expr], Tuple[relay.Expr]]
          The body of the loop, should be a function which
          given loop variables produces the output result
          also as a tuple
  
      Returns
      -------
      loop: relay.Expr
          The loop expression.
      """
      sb = ScopeBuilder()
      loop = _expr.Var("while_loop")
      fresh_vars = []
  
      for i, loop_var in enumerate(loop_vars):
          name = (
              loop_var.name_hint
              if isinstance(loop_var, _expr.Var)
              else f"arg{i}"
          )
          new_var = _expr.var(
              name,
              type_annotation=sb.type_of(loop_var),
              span=loop_var.span,
          )
          fresh_vars.append(new_var)
  
      with sb.if_scope(cond(*fresh_vars)):
          sb.ret(loop(*loop_bodies(*fresh_vars)))
      with sb.else_scope():
          sb.ret(_expr.Tuple(fresh_vars))
  
      func = _function.Function(fresh_vars, sb.get())
      let = _expr.Let(loop, func, loop)
      return let
  
imports: from .scope_builder import ScopeBuilder
  from .None import expr
  from .None import function
label_desc: Use image node_id 1 for calling a global function with example usage: while_loop(cond, loop_vars, loop_bodies) and returns: let