parameters: (self,
                                     sess,
                                     tags,
                                     signature_def_map=None,
                                     assets_collection=None)
docstring: Adds the current meta graph to the SavedModel and saves variables.
  
      Creates a Saver to save the variables from the provided session. Exports the
      corresponding meta graph def. This function assumes that the variables to be
      saved have been initialized. For a given `SavedModelBuilder`, this API must
      be called exactly once and for the first meta graph to save. For subsequent
      meta graph defs to be added, the `add_meta_graph()` API must be used.
  
      Args:
        sess: The TensorFlow session from which to save the meta graph and
          variables.
        tags: The set of tags with which to save the meta graph.
        signature_def_map: The map of signature def map to add to the meta graph
          def.
        assets_collection: Assets collection to be saved with SavedModel.
docstring_summary: Adds the current meta graph to the SavedModel and saves variables.
docstring_tokens: Adds the current meta graph to the SavedModel and saves variables .
function: def add_meta_graph_and_variables(self,
                                     sess,
                                     tags,
                                     signature_def_map=None,
                                     assets_collection=None):
      """Adds the current meta graph to the SavedModel and saves variables.
  
      Creates a Saver to save the variables from the provided session. Exports the
      corresponding meta graph def. This function assumes that the variables to be
      saved have been initialized. For a given `SavedModelBuilder`, this API must
      be called exactly once and for the first meta graph to save. For subsequent
      meta graph defs to be added, the `add_meta_graph()` API must be used.
  
      Args:
        sess: The TensorFlow session from which to save the meta graph and
          variables.
        tags: The set of tags with which to save the meta graph.
        signature_def_map: The map of signature def map to add to the meta graph
          def.
        assets_collection: Assets collection to be saved with SavedModel.
      """
      if self._has_saved_variables:
        raise AssertionError("Variables and assets have already been saved. "
                             "Please invoke `add_meta_graph()` instead.")
  
      # Save asset files and write them to disk, if any.
      self._save_and_write_assets(assets_collection)
  
      # Create the variables sub-directory, if it does not exist.
      variables_dir = os.path.join(
          compat.as_text(self._export_dir),
          compat.as_text(constants.VARIABLES_DIRECTORY))
      if not file_io.file_exists(variables_dir):
        file_io.recursive_create_dir(variables_dir)
  
      variables_path = os.path.join(
          compat.as_text(variables_dir),
          compat.as_text(constants.VARIABLES_FILENAME))
  
      # Save the variables and export meta graph def.
      saver = tf_saver.Saver(variables.all_variables(), sharded=True)
      saver.save(sess, variables_path, write_meta_graph=False)
      meta_graph_def = saver.export_meta_graph()
  
      # Tag the meta graph def and add it to the SavedModel.
      self._tag_and_add_meta_graph(meta_graph_def, tags, signature_def_map)
  
      # Mark this instance of SavedModel as having saved variables, such that
      # subsequent attempts to save variables will fail.
      self._has_saved_variables = True
function_tokens: def add_meta_graph_and_variables ( self , sess , tags , signature_def_map = None , assets_collection = None ) : if self . _has_saved_variables : raise AssertionError ( "Variables and assets have already been saved. " "Please invoke `add_meta_graph()` instead." ) # Save asset files and write them to disk, if any. self . _save_and_write_assets ( assets_collection ) # Create the variables sub-directory, if it does not exist. variables_dir = os . path . join ( compat . as_text ( self . _export_dir ) , compat . as_text ( constants . VARIABLES_DIRECTORY ) ) if not file_io . file_exists ( variables_dir ) : file_io . recursive_create_dir ( variables_dir ) variables_path = os . path . join ( compat . as_text ( variables_dir ) , compat . as_text ( constants . VARIABLES_FILENAME ) ) # Save the variables and export meta graph def. saver = tf_saver . Saver ( variables . all_variables ( ) , sharded = True ) saver . save ( sess , variables_path , write_meta_graph = False ) meta_graph_def = saver . export_meta_graph ( ) # Tag the meta graph def and add it to the SavedModel. self . _tag_and_add_meta_graph ( meta_graph_def , tags , signature_def_map ) # Mark this instance of SavedModel as having saved variables, such that # subsequent attempts to save variables will fail. self . _has_saved_variables = True