merlin.models.tf.losses.CategoricalCrossEntropy#

class merlin.models.tf.losses.CategoricalCrossEntropy(from_logits=True, **kwargs)[source]#

Bases: keras.losses.CategoricalCrossentropy, merlin.models.tf.losses.base.LossRegistryMixin

Extends tf.keras.losses.SparseCategoricalCrossentropy by making from_logits=True by default (in this case an optimized softmax activation is applied within this loss, you should not include softmax activation manually in the output layer). It also adds support to the loss_registry, so that the loss can be defined by the user by a string alias name.

__init__(from_logits=True, **kwargs)[source]#

Methods

__init__([from_logits])

call(y_true, y_pred)

Invokes the LossFunctionWrapper instance.

from_config(config)

Instantiates a Loss from its config (output of get_config()).

get_config()

parse(class_or_str)

Attributes

registry