Created
May 2, 2020 02:36
-
-
Save sayakpaul/37ff985295c74d186b0cf6e5a492efa1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
policy = tf.keras.mixed_precision.experimental.Policy('mixed_float16') | |
model = tf.keras.models.Sequential( | |
tf.keras.layers.Input((100,)), | |
tf.keras.layers.Dense(10, dtype=policy), | |
tf.keras.layers.Dense(10, dtype=policy), | |
# Softmax should be done in float32 for numeric stability. | |
tf.keras.layers.Activation('Softmax', dtype='float32') | |
) | |
model.fit(...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment