I'm converting conv2d model written by pytorch to keras(Tensorflow 2.0).
I've almost done, but last question is delaying my work.
The title says it all: is there an equivalent function pytorch's loss fuction nn.crossEntropyLoss() in keras?
Thanks for your help.
Depending on type of your labels and outputs, there are currently three different entropy losses supported in Keras.
categorical_crossentropy :
keras.losses.categorical_crossentropy(y_true, y_pred, from_logits=False, label_smoothing=0)
sparse_categorical_crossentropy :
keras.losses.sparse_categorical_crossentropy(y_true, y_pred, from_logits=False, axis=-1)
binary_crossentropy :
keras.losses.binary_crossentropy(y_true, y_pred, from_logits=False, label_smoothing=0)
You can find a full list of Keras losses here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.