tf.keras.backend.set_floatx
Sets the default float type.
tf.keras.backend.set_floatx(
value
)
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. |