tf.saved_model.save

Exports a tf.Module (and subclasses) obj to SavedModel format.

Used in the notebooks

Used in the guide Used in the tutorials

The obj must inherit from the Trackable class.

Example usage:

class Adder(tf.Module):
  @tf.function(input_signature=[tf.TensorSpec(shape=[], dtype=tf.float32)])
  def add(self, x):
    return x + x
model = Adder()
tf.saved_model.save(model, '/tmp/adder')

The resulting SavedModel is then servable with an input named "x", a scalar with dtype float32.

Signatures

Signatures define the input and output types for a computation. The optional save signatures a