# tff.learning.models.save

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |

Serializes `model` as a TensorFlow SavedModel to `path`.

    tff.learning.models.save(
        model: https://www.tensorflow.org/federated/api_docs/python/tff/learning/models/VariableModel,
        path: str,
        input_type=None
    ) -> None

The resulting SavedModel will contain the default serving signature, which
can be used with the TFLite converter to create a TFLite flatbuffer for
inference.

> [!NOTE]
> **Note:** The model returned by [`tff.learning.models.load`](https://www.tensorflow.org/federated/api_docs/python/tff/learning/models/load) will *not* be the same Python type as the saved model. If the model serialized using this method is a subclass of [`tff.learning.models.VariableModel`](https://www.tensorflow.org/federated/api_docs/python/tff/learning/models/VariableModel), that subclass is *not* returned. All method behavior is retained, but the Python type does not cross serialization boundaries. The return type of `metric_finalizers` will be an OrderedDict of str to [`tff.tensorflow.computation`](https://www.tensorflow.org/federated/api_docs/python/tff/tensorflow/computation) (annotated TFF computations) which could be different from that of the model before serialization.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `model` | The [`tff.learning.models.VariableModel`](https://www.tensorflow.org/federated/api_docs/python/tff/learning/models/VariableModel) to save. |
| `path` | The `str` directory path to serialize the model to. |
| `input_type` | An optional structure of [`tf.TensorSpec`](https://www.tensorflow.org/api_docs/python/tf/TensorSpec)s representing the expected input of `model.predict_on_batch`, to override reading from `model.input_spec`. Typically this will be similar to `model.input_spec`, with any example labels removed. If None, default to `model.input_spec['x']` if the input_spec is a mapping, otherwise default to `model.input_spec[0]`. |

<br />