W3cubDocs

/TensorFlow 2.3

tf.keras.backend.set_floatx

View source on GitHub

Sets the default float type.

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.experimental.set_policy('mixed_float16'). See the mixed precision guide for details.
Arguments
value String; 'float16', 'float32', or 'float64'.

Example:

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

Raises
ValueError In case of invalid value.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/keras/backend/set_floatx