Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.

fix ctc symbol modalities #1845

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tensor2tensor/layers/modalities.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,9 @@ def video_raw_targets_bottom(x, model_hparams, vocab_size):
# Loss transformations, applied to target features


def ctc_symbol_loss(top_out, targets, model_hparams, vocab_size, weight_fn):
def ctc_symbol_loss(top_out, targets, model_hparams, vocab_size, weights_fn):
"""Compute the CTC loss."""

del model_hparams, vocab_size # unused arg
logits = top_out
with tf.name_scope("ctc_loss", values=[logits, targets]):
Expand All @@ -658,7 +659,7 @@ def ctc_symbol_loss(top_out, targets, model_hparams, vocab_size, weight_fn):
time_major=False,
preprocess_collapse_repeated=False,
ctc_merge_repeated=False)
weights = weight_fn(targets)
weights = weights_fn(targets)
return tf.reduce_sum(xent), tf.reduce_sum(weights)


Expand Down