class_docstr: Set and restore trainable state if it has changed since compile.
  
  The keras API guarantees that the value of each Layer's `trainable` property
  at `Model.compile` time will be used when training that model. In order to
  respect this requirement, it may be necessary to set the trainable value of
  layers to their compile time values before beginning a training endpoint and
  restore the values before returing from said endpoint. This scope checks if
  any layer's trainable state has changed since Model compile, and performs this
  set and un-set bookkeeping.
  
  However, the trainable state of a layer changes quite infrequently, if ever,
  for many kinds of workflows. Moreover, updating every layer in a model is an
  expensive operation. As a result, we will only explicitly set and unset the
  trainable state of a model if a trainable value has changed since compile.
code: def __exit__(self, type_arg, value_arg, traceback_arg):
      # If we set the values to their compiled state in __enter__, we need to
      # restore the original values before leaving the scope.
      if self._should_set_trainable:
          self._model._set_trainable_state(
              self._current_trainable_state
          )  # pylint: disable=protected-access
      return False
  
file_path: tensorflow-upstream/tensorflow/python/keras/engine/training_utils.py
imports: import numpy
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.keras.utils import generic_utils
  from tensorflow.python.ops import array_ops
  from tensorflow.python.util import nest
label_desc: Use image node_id 3 for calling the RespectCompiledTrainableState obj's underlying member method code with example usage: obj.__exit__(type_arg, value_arg, traceback_arg) and returns: False