MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / compute_ctc_loss

Function compute_ctc_loss

tensorflow/python/ops/ctc_ops.py:840–860  ·  view source on GitHub ↗

Compute CTC loss.

(logits_t, labels_t, label_length_t, logit_length_t,
                         *unique_t)

Source from the content-addressed store, hash-verified

838
839 @custom_gradient.custom_gradient
840 def compute_ctc_loss(logits_t, labels_t, label_length_t, logit_length_t,
841 *unique_t):
842 """Compute CTC loss."""
843 logits_t.set_shape(logits.shape)
844 labels_t.set_shape(labels.shape)
845 label_length_t.set_shape(label_length.shape)
846 logit_length_t.set_shape(logit_length.shape)
847 kwargs = dict(
848 logits=logits_t,
849 labels=labels_t,
850 label_length=label_length_t,
851 logit_length=logit_length_t)
852 if unique_t:
853 kwargs["unique"] = unique_t
854 result = ctc_loss_and_grad(**kwargs)
855 def grad(grad_loss):
856 grad = [array_ops.reshape(grad_loss, [1, -1, 1]) * result[1]]
857 grad += [None] * (len(args) - len(grad))
858 return grad
859
860 return result[0], grad
861
862 return compute_ctc_loss(*args)
863

Callers 1

ctc_loss_denseFunction · 0.85

Calls 2

ctc_loss_and_gradFunction · 0.85
set_shapeMethod · 0.45

Tested by

no test coverage detected