# tff.learning.models.from_keras_model

<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) |

    tff.learning.models.from_keras_model(
        keras_model: tf.keras.Model,
        loss: Loss,
        input_spec,
        loss_weights: Optional[list[float]] = None,
        metrics: Optional[Union[list[tf.keras.metrics.Metric], list[Callable[[], tf.keras.
            metrics.Metric]]]] = None
    ) -> https://www.tensorflow.org/federated/api_docs/python/tff/learning/models/VariableModel

### Used in the notebooks

| Used in the tutorials |
|---|
| - [Federated Learning for Image Classification](https://www.tensorflow.org/federated/tutorials/federated_learning_for_image_classification) - [Federated Learning for Text Generation](https://www.tensorflow.org/federated/tutorials/federated_learning_for_text_generation) - [Differential Privacy in TFF](https://www.tensorflow.org/federated/tutorials/federated_learning_with_differential_privacy) - [TFF simulations with accelerators](https://www.tensorflow.org/federated/tutorials/simulations_with_accelerators) |