class_docstr: Updates the method name(s) of the SavedModel stored in the given path.
  
  The `MethodNameUpdater` class provides the functionality to update the method
  name field in the signature_defs of the given SavedModel. For example, it
  can be used to replace the `predict` `method_name` to `regress`.
  
  Typical usages of the `MethodNameUpdater`
  ```python
  ...
  updater = tf.compat.v1.saved_model.signature_def_utils.MethodNameUpdater(
      export_dir)
  # Update all signature_defs with key "foo" in all meta graph defs.
  updater.replace_method_name(signature_key="foo", method_name="regress")
  # Update a single signature_def with key "bar" in the meta graph def with
  # tags ["serve"]
  updater.replace_method_name(signature_key="bar", method_name="classify",
                              tags="serve")
  updater.save(new_export_dir)
  ```
  
  Note: This function will only be available through the v1 compatibility
  library as tf.compat.v1.saved_model.builder.MethodNameUpdater.
class_docstr_tok: ["Updates","the","method","name","(","s",")","of","the","SavedModel","stored","in","the","given","path",".","The","`","MethodNameUpdater","`","class","provides","the","functionality","to","update","the","method","name","field","in","the","signature_defs","of","the","given","SavedModel",".","For","example",",","it","can","be","used","to","replace","the","`","predict","`","`","method_name","`","to","`","regress","`",".","Typical","usages","of","the","`","MethodNameUpdater","`","``","`","python","...","updater","=","tf.compat.v1.saved_model.signature_def_utils.MethodNameUpdater","(","export_dir",")","#","Update","all","signature_defs","with","key","``","foo","''","in","all","meta","graph","defs",".","updater.replace_method_name","(","signature_key=","''","foo","''",",","method_name=","''","regress","''",")","#","Update","a","single","signature_def","with","key","``","bar","''","in","the","meta","graph","def","with","#","tags","[","``","serve","''","]","updater.replace_method_name","(","signature_key=","''","bar","''",",","method_name=","''","classify","''",",","tags=","''","serve","''",")","updater.save","(","new_export_dir",")","``","`","Note",":","This","function","will","only","be","available","through","the","v1","compatibility","library","as","tf.compat.v1.saved_model.builder.MethodNameUpdater","."]
docstr: Saves the updated `SavedModel`.
  
  Args:
    new_export_dir: Path where the updated `SavedModel` will be saved. If
        None, the input `SavedModel` will be overriden with the updates.
  
  Raises:
    errors.OpError: If there are errors during the file save operation.
docstr_tok: ["Saves","the","updated","`","SavedModel","`",".","Args",":","new_export_dir",":","Path","where","the","updated","`","SavedModel","`","will","be","saved",".","If","None",",","the","input","`","SavedModel","`","will","be","overriden","with","the","updates",".","Raises",":","errors.OpError",":","If","there","are","errors","during","the","file","save","operation","."]
code: def save(self, new_export_dir=None):
      """Saves the updated `SavedModel`.
  
      Args:
        new_export_dir: Path where the updated `SavedModel` will be saved. If
            None, the input `SavedModel` will be overriden with the updates.
  
      Raises:
        errors.OpError: If there are errors during the file save operation.
      """
  
      is_input_text_proto = file_io.file_exists(
          file_io.join(
              compat.as_bytes(self._export_dir),
              compat.as_bytes(constants.SAVED_MODEL_FILENAME_PBTXT),
          )
      )
      if not new_export_dir:
          new_export_dir = self._export_dir
  
      if is_input_text_proto:
          # TODO(jdchung): Add a util for the path creation below.
          path = file_io.join(
              compat.as_bytes(new_export_dir),
              compat.as_bytes(constants.SAVED_MODEL_FILENAME_PBTXT),
          )
          file_io.write_string_to_file(path, str(self._saved_model))
      else:
          path = file_io.join(
              compat.as_bytes(new_export_dir),
              compat.as_bytes(constants.SAVED_MODEL_FILENAME_PB),
          )
          file_io.write_string_to_file(
              path,
              self._saved_model.SerializeToString(deterministic=True),
          )
      tf_logging.info("SavedModel written to: %s", compat.as_text(path))
  
file_path: tensorflow/tensorflow/python/saved_model/method_name_updater.py
imports: from tensorflow.python.lib.io import file_io
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.saved_model import constants
  from tensorflow.python.saved_model import loader_impl
  from tensorflow.python.util import compat
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 3 for calling the MethodNameUpdater obj's underlying member method code with example usage: obj.save(new_export_dir) without return types