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 predictmethod_name to regress.
Typical usages of the MethodNameUpdater
...
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)
Args
export_dir
Directory containing the SavedModel files.
Raises
IOError
If the saved model file does not exist, or cannot be successfully
parsed.
Replaces the method_name in the specified signature_def.
This will match and replace multiple sig defs iff tags is None (i.e when
multiple MetaGraphs have a signature_def with the same key).
If tags is not None, this will only replace a single signature_def in the
MetaGraph with matching tags.
Args
signature_key
Key of the signature_def to be updated.
method_name
new method_name to replace the existing one.
tags
A tag or sequence of tags identifying the MetaGraph to update. If
None, all meta graphs will be updated.
Raises
ValueError
if signature_key or method_name are not defined or
if no metagraphs were found with the associated tags or
if no meta graph has a signature_def that matches signature_key.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[],[]]