Skip to content

Instantly share code, notes, and snippets.

@NoelKennedy
Created January 24, 2019 11:06
Show Gist options
  • Save NoelKennedy/dff897272e234e8af1aa00886180075b to your computer and use it in GitHub Desktop.
Save NoelKennedy/dff897272e234e8af1aa00886180075b to your computer and use it in GitHub Desktop.
How to configure keras - tensorflow for training using FP16
import keras.backend as K
dtype='float16'
K.set_floatx(dtype)
# default is 1e-7 which is too small for float16. Without adjusting the epsilon, we will get NaN predictions because of divide by zero problems
K.set_epsilon(1e-4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment