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 __init__(
      self, is_record, train_mode
  ):  # pylint: disable=redefined-outer-name
      self._enter_is_record = is_record
      self._enter_train_mode = train_mode
      self._prev_is_record = None
      self._prev_train_mode = None
  
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 1 to create a new _RecordingStateScope object from inherited base classes: object with example: obj = _RecordingStateScope(is_record, train_mode)