parameters: (between_op_list, between_ops,
                                  colocate_gradients_with_ops)
return_statement: return loop_state
docstring: Create the state for all the while loops involved in one gradients().
  
    We create a ControlFlowState when there are while loops involved in
    gradients(). In gradients(), control flow logic is only invoked when
    the ControlFlowState is not None.
  
    Note that this method modifies `between_op_list` and `between_ops`.
docstring_summary: Create the state for all the while loops involved in one gradients().
docstring_tokens: Create the state for all the while loops involved in one gradients () .
function: def MaybeCreateControlFlowState(between_op_list, between_ops,
                                  colocate_gradients_with_ops):
    """Create the state for all the while loops involved in one gradients().
  
    We create a ControlFlowState when there are while loops involved in
    gradients(). In gradients(), control flow logic is only invoked when
    the ControlFlowState is not None.
  
    Note that this method modifies `between_op_list` and `between_ops`.
    """
    loop_state = None
    for op in between_op_list:
      if IsLoopExit(op):
        if loop_state is None:
          loop_state = ControlFlowState()
        if colocate_gradients_with_ops:
          with ops.colocate_with(op):
            loop_state.AddWhileContext(op, between_op_list, between_ops)
        else:
          loop_state.AddWhileContext(op, between_op_list, between_ops)
    return loop_state
function_tokens: def MaybeCreateControlFlowState ( between_op_list , between_ops , colocate_gradients_with_ops ) : loop_state = None for op in between_op_list : if IsLoopExit ( op ) : if loop_state is None : loop_state = ControlFlowState ( ) if colocate_gradients_with_ops : with ops . colocate_with ( op ) : loop_state . AddWhileContext ( op , between_op_list , between_ops ) else : loop_state . AddWhileContext ( op , between_op_list , between_ops ) return loop_state