class_docstr: Patches for TensorFlow.
  
  There are multiple "monkey patches":
  1) Patches the `value` attribute of a `ResourceVariable` to return
  the `graph_element` or `cached_value` instead of a `ReadVariableOp`.
  Not having to read the variable from memory again can provide
  performance increases.
  2) Patches optimizers to save their type and arguments so that we
  can re-create them when partitioning variables.
  3) Patches Keras' `Session` fetcher to return AutoDist's custom `Session`
  so that AutoDist is compatible with Keras.
docstr: Patch Keras way of getting session.
docstr_tok: ["Patch","Keras","way","of","getting","session","."]
code: def patch_keras():
      """Patch Keras way of getting session."""
      setattr(keras.backend, "READY_FOR_AUTODIST", False)
  
      def _compile(self, *args, **kwargs):
          PatchTensorFlow._DEFAULT_MODEL_COMPILE(self, *args, **kwargs)
          setattr(keras.backend, "READY_FOR_AUTODIST", True)
  
      training.Model.compile = _compile
  
      keras.backend._get_session = _KerasPatch.get_session
  
      keras.backend.GraphExecutionFunction = (
          _KerasPatch.GraphExecutionFunction
      )
  
imports: from collections import deque
  from itertools import chain
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.python import keras
  from tensorflow.python.client import session
  from tensorflow.python.framework import ops
  from tensorflow.python.keras.engine import training
  from tensorflow.python.keras.optimizer_v2.optimizer_v2 import OptimizerV2
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops.resource_variable_ops import ResourceVariable
  from tensorflow.python.training.optimizer import Optimizer
  import autodist.autodist
  from autodist.graph_item import wrap_optimizer_init, wrap_optimizer_apply_gradient
  from autodist.runner import get_default_session_config
  from autodist.utils import logging
label_desc: Use image node_id 4 for calling the PatchTensorFlow obj's underlying member method code with example usage: obj.patch_keras() without return types