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
Context for dynamic graph execution mode.

    Args:
        auto (bool): Whether forward computation is executed during a
            computation graph construction.

    Returns: bool