View source on GitHub
|
Options for saving to SavedModel.
tf.saved_model.SaveOptions(
namespace_whitelist=None,
save_debug_info=False,
function_aliases=None,
experimental_debug_stripper=False,
experimental_io_device=None,
experimental_variable_policy=None,
experimental_custom_gradients=True,
experimental_image_format=False,
experimental_skip_saver=False,
experimental_sharding_callback=None
)
Used in the notebooks
| Used in the guide | Used in the tutorials |
|---|---|
This function may be used in the options argument in functions that
save a SavedModel (tf.saved_model.save, tf.keras.models.save_model).
Args |
|---|
namespace_whitelist
save_debug_info
function_aliases
function_aliases argument to
store a map from the alias name to all concrete function names. E.g. >>>
class Adder(tf.Module): ... @tf.function ... def double(self, x):
... return x + x >>> model = Adder() >>>
model.double.get_concrete_function( ... tf.TensorSpec(shape=[],
dtype=tf.float32, name="float_input")) >>>
model.double.get_concrete_function( ... tf.TensorSpec(shape=[],
dtype=tf.string, name="string_input")) >>> options =
tf.saved_model.SaveOptions( ... function_aliases={'double':
model.double}) >>> tf.saved_model.save(model, '/tmp/adder',
options=options)
experimental_debug_stripper
Assert nodes from the graph and
converts them into NoOps instead.
experimental_io_device
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. 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.
experimental_variable_policy
saved_model.experimental.VariablePolicy enum
instance or one of its value strings (case is not important). See that
enum documentation for details. A value of None corresponds to the
default policy.
experimental_custom_gradients
tf.custom_gradient.
Defaults to True.
experimental_image_format
experimental_skip_saver
experimental_sharding_callback
tf.train.experimental.ShardingCallback.
A pre-made or custom callback that determines how checkpoints are
sharded on disk. Pre-made callback options are
tf.train.experimental.ShardByDevicePolicy and
tf.train.experimental.MaxShardSizePolicy. You may also write a custom
callback, see tf.train.experimental.ShardingCallback.
Attributes |
|---|
experimental_custom_gradients
experimental_debug_stripper
experimental_image_format
experimental_io_device
experimental_sharding_callback
experimental_skip_saver
experimental_variable_policy
function_aliases
namespace_whitelist
save_debug_info
View source on GitHub