# tf.saved_model.SaveOptions

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.3.0/tensorflow/python/saved_model/save_options.py#L28-L95) |

Options for saving to SavedModel.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.saved_model.SaveOptions`](https://www.tensorflow.org/api_docs/python/tf/saved_model/SaveOptions)

<br />

    tf.saved_model.SaveOptions(
        namespace_whitelist=None, save_debug_info=False, function_aliases=None,
        experimental_io_device=None
    )

This function may be used in the `options` argument in functions that
save a SavedModel ([`tf.saved_model.save`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/saved_model/save), [`tf.keras.models.save_model`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/keras/models/save_model)).

<br />

<br />

<br />

| ## Args ||
|---|---|
| `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. <br /> class MyModel: @tf.function def func(): ... @tf.function def serve(): ... func() model = MyModel() signatures = { 'serving_default': model.serve.get_concrete_function(), } options = tf.saved_model.SaveOptions(function_aliases={ 'my_func': func, }) tf.saved_model.save(model, export_dir, signatures, options) <br /> |
| `experimental_io_device` | string. Applies in a distributed setting. Tensorflow device to use to access the filesystem. If `None` (default) then for each variable the filesystem is accessed from the CPU:0 device of the host where that variable is assigned. If specified, the filesystem is instead accessed from that device for all variables. <br /> This is for example useful if you want to save to a local directory, such as "/tmp" when running in a distributed setting. In that case pass a device for the host where the "/tmp" directory is accessible. |

<br />

## Class Variables

- `experimental_io_device`
- `function_aliases`
- `namespace_whitelist`
- `save_debug_info`