class_docstr: Scope for managing training state.
  
  Example::
  
      with _RecordingStateScope(True, True):
          y = model(x)
          backward([y])
class_docstr_tok: ["Scope","for","managing","training","state",".","Example",":",":","with","_RecordingStateScope","(","True",",","True",")",":","y","=","model","(","x",")","backward","(","[","y","]",")"]
code: def __exit__(self, ptype, value, trace):
      if (
          self._enter_is_record is not None
          and self._prev_is_record != self._enter_is_record
      ):
          set_recording(self._prev_is_record)
      if (
          self._enter_train_mode is not None
          and self._prev_train_mode != self._enter_train_mode
      ):
          set_training(self._prev_train_mode)
  
imports: from array import array
  from threading import Lock
  import traceback
  import ctypes
  from ctypes import c_int, c_void_p, CFUNCTYPE, POINTER, cast
  from .base import _LIB, check_call, string_types, mx_uint
  from .base import NDArrayHandle, c_array, c_handle_array, c_array_buf, MXCallbackList, SymbolHandle
  from .ndarray import NDArray, _ndarray_cls
  from .ndarray import _GRAD_REQ_MAP
  from .symbol import Symbol
  from .util import is_np_array
label_desc: Use image node_id 3 for calling the _RecordingStateScope obj's underlying member method code with example usage: obj.__exit__(ptype, value, trace) without return types