Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tfa.seq2seq.SequenceLoss

View source on GitHub

Class SequenceLoss

Weighted cross-entropy loss for a sequence of logits.

__init__

View source

__init__(
    average_across_timesteps=False,
    average_across_batch=False,
    sum_over_timesteps=True,
    sum_over_batch=True,
    softmax_loss_function=None,
    name=None
)

Initialize self. See help(type(self)) for accurate signature.

Methods

__call__

View source

__call__(
    y_true,
    y_pred,
    sample_weight=None
)

Override the parent call to have a customized reduce behavior.

from_config

@classmethod
from_config(
    cls,
    config
)

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

Args:

  • config: Output of get_config().

Returns:

A Loss instance.

get_config

get_config()