tfa.seq2seq.SequenceLoss

Stay organized with collections Save and categorize content based on your preferences.

Weighted cross-entropy loss for a sequence of logits.

reduction Type of tf.keras.losses.Reduction to apply to loss. Default value is AUTO. AUTO indicates that the reduction option will be determined by the usage context. For almost all cases this defaults to SUM_OVER_BATCH_SIZE. When used with tf.distribute.Strategy, outside of built-in training loops such as tf.keras compile and fit, using AUTO or SUM_OVER_BATCH_SIZE will raise an error. Please see this custom training tutorial for more details.
name Optional name for the instance.

Methods

from_config

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

Args
config Output of get_config().

Returns
A Loss instance.

get_config

Returns the config dictionary for a Loss instance.

__call__

View source

Override the parent call to have a customized reduce behavior.