class_docstr: LazyLoader that handles routing to different Keras version.
class_docstr_tok: ["LazyLoader","that","handles","routing","to","different","Keras","version","."]
docstr: Resolve the Keras version to use and initialize the loader.
docstr_tok: ["Resolve","the","Keras","version","to","use","and","initialize","the","loader","."]
code: def _initialize(self):
      """Resolve the Keras version to use and initialize the loader."""
      self._tfll_initialized = True
      package_name = None
      keras_version = None
      if os.environ.get("TF_USE_LEGACY_KERAS", None) in (
          "true",
          "True",
          "1",
      ):
          try:
              import tf_keras  # pylint: disable=g-import-not-at-top,unused-import
  
              keras_version = "tf_keras"
              if self._tfll_mode == "v1":
                  package_name = "tf_keras.api._v1.keras"
              else:
                  package_name = "tf_keras.api._v2.keras"
          except ImportError:
              logging.warning(
                  "Your environment has TF_USE_LEGACY_KERAS set to True, but you "
                  "do not have the tf_keras package installed. You must install it "
                  "in order to use the legacy tf.keras. Install it via: "
                  "`pip install tf_keras`"
              )
      else:
          try:
              import keras  # pylint: disable=g-import-not-at-top
  
              if keras.__version__.startswith("3."):
                  # This is the Keras 3.x case.
                  keras_version = "keras_3"
                  package_name = "keras._tf_keras.keras"
              else:
                  # This is the Keras 2.x case.
                  keras_version = "keras_2"
                  if self._tfll_mode == "v1":
                      package_name = "keras.api._v1.keras"
                  else:
                      package_name = "keras.api._v2.keras"
          except ImportError:
              raise ImportError(  # pylint: disable=raise-missing-from
                  "Keras cannot be imported. Check that it is installed."
              )
  
      self._tfll_keras_version = keras_version
      if keras_version is not None:
          if self._tfll_submodule is not None:
              package_name += "." + self._tfll_submodule
          super().__init__(
              self._tfll_name,
              self._tfll_parent_module_globals,
              package_name,
          )
      else:
          raise ImportError(  # pylint: disable=raise-missing-from
              "Keras cannot be imported. Check that it is installed."
          )
  
imports: import importlib
  import os
  import types
  from tensorflow.python.platform import tf_logging
label_desc: Use image node_id 2 for calling the KerasLazyLoader obj's underlying member method code with example usage: obj._initialize() without return types