class_docstr: Builds the `SavedModel` protocol buffer and saves variables and assets.
  
  The `SavedModelBuilder` class provides the functionality to build a
  `SavedModel` protocol buffer. Specifically, this allows multiple meta
  graphs to be saved as part of a single language-neutral `SavedModel`,
  while sharing variables and assets.
  
  To build a SavedModel, the first meta graph must be saved with variables.
  Subsequent meta graphs will simply be saved with their graph definitions. If
  assets need to be saved and written or copied to disk, they can be provided
  when the meta graph def is added. If multiple meta graph defs are associated
  an asset of the same name, only the first version is retained.
  
  Each meta graph added to the SavedModel must be annotated with tags. The tags
  provide a means to identify the specific meta graph to load and restore, along
  with the shared set of variables and assets.
  
  Typical usage for the `SavedModelBuilder`:
  
  ```python
  ...
  builder = tf.compat.v1.saved_model.Builder(export_dir)
  
  with tf.compat.v1.Session(graph=tf.Graph()) as sess:
    ...
    builder.add_meta_graph_and_variables(sess,
                                    ["foo-tag"],
                                    signature_def_map=foo_signatures,
                                    assets_list=foo_assets)
  ...
  
  with tf.compat.v1.Session(graph=tf.Graph()) as sess:
    ...
    builder.add_meta_graph(["bar-tag", "baz-tag"])
  ...
  
  builder.save()
  ```
  
  Note: This function will only be available through the v1 compatibility
  library as tf.compat.v1.saved_model.builder.SavedModelBuilder or
  tf.compat.v1.saved_model.Builder. Tensorflow 2.0 will introduce a new
  object-based method of creating SavedModels.
class_docstr_tok: ["Builds","the","`","SavedModel","`","protocol","buffer","and","saves","variables","and","assets",".","The","`","SavedModelBuilder","`","class","provides","the","functionality","to","build","a","`","SavedModel","`","protocol","buffer",".","Specifically",",","this","allows","multiple","meta","graphs","to","be","saved","as","part","of","a","single","language-neutral","`","SavedModel","`",",","while","sharing","variables","and","assets",".","To","build","a","SavedModel",",","the","first","meta","graph","must","be","saved","with","variables",".","Subsequent","meta","graphs","will","simply","be","saved","with","their","graph","definitions",".","If","assets","need","to","be","saved","and","written","or","copied","to","disk",",","they","can","be","provided","when","the","meta","graph","def","is","added",".","If","multiple","meta","graph","defs","are","associated","an","asset","of","the","same","name",",","only","the","first","version","is","retained",".","Each","meta","graph","added","to","the","SavedModel","must","be","annotated","with","tags",".","The","tags","provide","a","means","to","identify","the","specific","meta","graph","to","load","and","restore",",","along","with","the","shared","set","of","variables","and","assets",".","Typical","usage","for","the","`","SavedModelBuilder","`",":","``","`","python","...","builder","=","tf.compat.v1.saved_model.Builder","(","export_dir",")","with","tf.compat.v1.Session","(","graph=tf.Graph","(",")",")","as","sess",":","...","builder.add_meta_graph_and_variables","(","sess",",","[","``","foo-tag","''","]",",","signature_def_map=foo_signatures",",","assets_list=foo_assets",")","...","with","tf.compat.v1.Session","(","graph=tf.Graph","(",")",")","as","sess",":","...","builder.add_meta_graph","(","[","``","bar-tag","''",",","``","baz-tag","''","]",")","...","builder.save","(",")","``","`","Note",":","This","function","will","only","be","available","through","the","v1","compatibility","library","as","tf.compat.v1.saved_model.builder.SavedModelBuilder","or","tf.compat.v1.saved_model.Builder",".","Tensorflow","2.0","will","introduce","a","new","object-based","method","of","creating","SavedModels","."]
docstr: Tags the meta graph def and adds it to the SavedModel.
  
  Tags the meta graph def with the supplied tags, adds signature defs to it if
  provided and appends the meta graph def to the SavedModel proto.
  
  Args:
    meta_graph_def: The meta graph def to add to the SavedModel.
    tags: The set of tags to annotate the meta graph def with.
    signature_def_map: The map of signature defs to be added to the meta graph
      def.
docstr_tok: ["Tags","the","meta","graph","def","and","adds","it","to","the","SavedModel",".","Tags","the","meta","graph","def","with","the","supplied","tags",",","adds","signature","defs","to","it","if","provided","and","appends","the","meta","graph","def","to","the","SavedModel","proto",".","Args",":","meta_graph_def",":","The","meta","graph","def","to","add","to","the","SavedModel",".","tags",":","The","set","of","tags","to","annotate","the","meta","graph","def","with",".","signature_def_map",":","The","map","of","signature","defs","to","be","added","to","the","meta","graph","def","."]
code: def _tag_and_add_meta_graph(
      self, meta_graph_def, tags, signature_def_map
  ):
      """Tags the meta graph def and adds it to the SavedModel.
  
      Tags the meta graph def with the supplied tags, adds signature defs to it if
      provided and appends the meta graph def to the SavedModel proto.
  
      Args:
        meta_graph_def: The meta graph def to add to the SavedModel.
        tags: The set of tags to annotate the meta graph def with.
        signature_def_map: The map of signature defs to be added to the meta graph
          def.
      """
      for tag in tags:
          meta_graph_def.meta_info_def.tags.append(tag)
  
      if signature_def_map is not None:
          for key in signature_def_map:
              meta_graph_def.signature_def[key].CopyFrom(
                  signature_def_map[key]
              )
  
      proto_meta_graph_def = self._saved_model.meta_graphs.add()
      proto_meta_graph_def.CopyFrom(meta_graph_def)
  
imports: import functools
  import os
  from google.protobuf.any_pb2 import Any
  from tensorflow.core.framework import types_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.core.protobuf import saved_model_pb2
  from tensorflow.core.protobuf import saver_pb2
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.lib.io import file_io
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.saved_model import fingerprinting_utils
  from tensorflow.python.saved_model import path_helpers
  from tensorflow.python.saved_model import signature_def_utils
  from tensorflow.python.saved_model.pywrap_saved_model import constants
  from tensorflow.python.saved_model.pywrap_saved_model import metrics
  from tensorflow.python.training import saver
  from tensorflow.python.util import compat
  from tensorflow.python.util.deprecation import deprecated_args
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 3 for calling the _SavedModelBuilder obj's underlying member method code with example usage: obj._tag_and_add_meta_graph(meta_graph_def, tags, signature_def_map) without return types