View source on GitHub

Options for saving to SavedModel.

This function may be used in the options argument in functions that save a SavedModel (, tf.keras.models.save_model).

namespace_whitelist List of strings containing op namespaces to whitelist when saving a model. Saving an object that uses namespaced ops must explicitly add all namespaces to the whitelist. The namespaced ops must be registered into the framework when loading the SavedModel.
save_debug_info Boolean indicating whether debug information is saved. If True, then a debug/saved_model_debug_info.pb file will be written with the contents of a GraphDebugInfo binary protocol buffer containing stack trace information for all ops and functions that are saved.
function_aliases Python dict. Mapping from string to object returned by @tf.function. A single tf.function can generate many ConcreteFunctions. If a downstream tool wants to refer to all concrete functions generated by a single tf.function you can use the function_aliases argument to store a map from the alias name to all concrete function names. E.g.

class MyModel:
def func():

def serve():

model = MyModel()
signatures = {
'serving_default': model.serve.get_concrete_function(),
options = tf.saved_model.SaveOptions(function_aliases={
'my_func': func,
}), export_dir, signatures, options)

Class Variables

  • function_aliases
  • namespace_whitelist
  • save_debug_info