convert_while_loop

paddle.fluid.dygraph.dygraph_to_static.convert_operators. convert_while_loop ( cond, body, loop_vars ) [source]

A function representation of a Python while statement.

Parameters
  • cond (Callable) – A callable object that returns a boolean variable to control whether to execute the loop body. It takes loop_vars as arguments.

  • body (Callable) – A callable object that returns a tuple or list of variables with the same arguments loops_vars as cond .

  • loop_vars (list|tuple) – A list or tuple of variables passed to cond and body .

Returns

A list or tuple of variables which returned by body.