tf.contrib.legacy_seq2seq.sequence_loss_by_example
Stay organized with collections
Save and categorize content based on your preferences.
Weighted cross-entropy loss for a sequence of logits (per example).
tf.contrib.legacy_seq2seq.sequence_loss_by_example(
logits, targets, weights, average_across_timesteps=True,
softmax_loss_function=None, name=None
)
Args |
logits
|
List of 2D Tensors of shape [batch_size x num_decoder_symbols].
|
targets
|
List of 1D batch-sized int32 Tensors of the same length as logits.
|
weights
|
List of 1D batch-sized float-Tensors of the same length as logits.
|
average_across_timesteps
|
If set, divide the returned cost by the total
label weight.
|
softmax_loss_function
|
Function (labels, logits) -> loss-batch to be used
instead of the standard softmax (the default if this is None). Note that
to avoid confusion, it is required for the function to accept named
arguments.
|
name
|
Optional name for this operation, default: "sequence_loss_by_example".
|
Returns |
1D batch-sized float Tensor: The log-perplexity for each sequence.
|
Raises |
ValueError
|
If len(logits) is different from len(targets) or len(weights).
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-10-01 UTC."],[],[]]