# tf.keras.backend.set_floatx

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v2.13.1/keras/backend_config.py#L82-L114) |

Sets the default float type.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

\`tf.compat.v1.keras.backend.set_floatx\`

<br />

    tf.keras.backend.set_floatx(
        value
    )

> [!NOTE]
> **Note:** It is not recommended to set this to float16 for training, as this will likely cause numeric stability issues. Instead, mixed precision, which is using a mix of float16 and float32, can be used by calling `tf.keras.mixed_precision.set_global_policy('mixed_float16')`. See the [mixed precision guide](https://www.tensorflow.org/guide/keras/mixed_precision) for details.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `value` | String; `'float16'`, `'float32'`, or `'float64'`. |

<br />

#### Example:

    tf.keras.backend.floatx()
    'float32'
    tf.keras.backend.set_floatx('float64')
    tf.keras.backend.floatx()
    'float64'
    tf.keras.backend.set_floatx('float32')

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | In case of invalid value. |

<br />