Skip to content

Instantly share code, notes, and snippets.

@satishgunjal
Created October 17, 2020 07:43
Show Gist options
  • Save satishgunjal/de66a43915327cfc4bb300a78f66f9ff to your computer and use it in GitHub Desktop.
Save satishgunjal/de66a43915327cfc4bb300a78f66f9ff to your computer and use it in GitHub Desktop.
model compile
# The from_logits=True attribute inform the loss function that the output values generated by the model are not normalized, a.k.a. logits.
# Since softmax layer is not being added at the last layer, hence we need to have the from_logits=True to indicate the probabilities are not normalized.
model.compile(optimizer= 'adam',
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
metrics = ['accuracy'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment