<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def auto_forward(auto=True):
 """ Context for dynamic graph execution mode. Args: auto (bool):
 Whether forward computation is executed during a computation graph construction. Returns: bool """

    global __auto_forward_state
    prev = __auto_forward_state
    __auto_forward_state = auto
    yield
    __auto_forward_state = prev