NetworkCtcLayer

NetworkCtcLayer.log_add(a, b)[source]
NetworkCtcLayer.log_sum(a, axis=None, keepdims=False)[source]
NetworkCtcLayer.log_mul(a, b)[source]
NetworkCtcLayer.log_div(a, b)[source]
NetworkCtcLayer.log_path_probs(log_pcx_y, time_mask, seq_lens, forward=True)[source]

No blanks. Calculates the forward/backward probabilities.

Parameters:
  • log_pcx_y – softmax output for labels, log-space. shape (time,batch,seqlen) -> log prob
  • time_mask – (time,batch) -> 0 or 1
  • seq_lens – (batch,) -> seqlen
Returns:

log probabilities. shape (time,batch,seqlen)

NetworkCtcLayer.ctc(log_pcx, time_mask, targets, seq_lens)[source]

No blanks. Calculates the CTC cost.

Parameters:
  • log_pcx – softmax output, log-space. shape (time,batch,label) -> log prob
  • time_mask – (time,batch) -> 0 or 1
  • targets – target seq, shape (seqlen,batch) -> label. seqlen <= time.
  • seq_lens – (batch,) -> seqlen
Returns:

probs: (time,batch,seqlen) -> log prob

NetworkCtcLayer.ctc_cost(*args, **kwargs)[source]

:returns total negative log probability (scalar)

NetworkCtcLayer.uniq_with_lengths(seq, time_mask)[source]
Parameters:
  • seq – (time,batch) -> label
  • time_mask – (time,batch) -> 0 or 1
Returns:

out_seqs, seq_lens.

out_seqs is (max_seq_len,batch) -> label, where max_seq_len <= time. seq_lens is (batch,) -> len.