# tff.simulation.models.mnist.create_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) |

Returns an instance of [`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model) for use with the MNIST example.

    tff.simulation.models.mnist.create_keras_model(
        compile_model=False
    )

This code is based on the following target, which unfortunately cannot be
imported as it is a Python binary, not a library:

<https://github.com/tensorflow/models/blob/master/official/r1/mnist/mnist.py>

<br />

<br />

<br />

| ## Args ||
|---|---|
| `compile_model` | If True, compile the model with a basic optimizer and loss. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A [`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model). ||

<br />