(logits,
                           sequence_length,
                           beam_width=1,
                           top_paths=1,
                           blank_id=None)
return decode_result_dense, probs
ctc beam search decode function
    param: logits, (B, T, C), output of ctc asr model
    param: sequence_length, (B, 1), sequence lengths
    param: beam_width, int, beam search beam width
    param: top_paths, int, controls output size
    return:
       decode_result, (B, T), decode result
       probs: A float matrix [batch_size, top_paths] containing sequence log-probabilities.
ctc beam search decode function
    param: logits, (B, T, C), output of ctc asr model
    param: sequence_length, (B, 1), sequence lengths
    param: beam_width, int, beam search beam width
    param: top_paths, int, controls output size
    return:
       decode_result, (B, T), decode result
       probs: A float matrix [batch_size, top_paths] containing sequence log-probabilities.
ctc beam search decode function param : logits ( B T C ) output of ctc asr model param : sequence_length ( B 1 ) sequence lengths param : beam_width int beam search beam width param : top_paths int controls output size return : decode_result ( B T ) decode result probs : A float matrix [ batch_size top_paths ] containing sequence log - probabilities .
def ctc_beam_search_decode(logits,
                           sequence_length,
                           beam_width=1,
                           top_paths=1,
                           blank_id=None):
  '''
    ctc beam search decode function
    param: logits, (B, T, C), output of ctc asr model
    param: sequence_length, (B, 1), sequence lengths
    param: beam_width, int, beam search beam width
    param: top_paths, int, controls output size
    return:
       decode_result, (B, T), decode result
       probs: A float matrix [batch_size, top_paths] containing sequence log-probabilities.
    '''

  logits, sequence_len, blank_id = ctc_decode_blankid_to_last(
      logits, sequence_length, blank_id)

  deps = [tf.assert_rank(logits, 3), tf.assert_rank(sequence_len, 1)]

  with tf.control_dependencies(deps):
    decode_result, probs = tf.nn.ctc_beam_search_decoder_v2(
        logits, sequence_len, beam_width=beam_width, top_paths=top_paths)
    decode_result_recovery_blank_id = [
        ctc_utils.labels_last_to_blankid(single_decode_result, blank_id)
        for single_decode_result in decode_result
    ]
    decode_result_dense = [
        tf.sparse_tensor_to_dense(result, default_value=blank_id)
        for result in decode_result_recovery_blank_id
    ]
  return decode_result_dense, probs
def ctc_beam_search_decode ( logits , sequence_length , beam_width = 1 , top_paths = 1 , blank_id = None ) : logits , sequence_len , blank_id = ctc_decode_blankid_to_last ( logits , sequence_length , blank_id ) deps = [ tf . assert_rank ( logits , 3 ) , tf . assert_rank ( sequence_len , 1 ) ] with tf . control_dependencies ( deps ) : decode_result , probs = tf . nn . ctc_beam_search_decoder_v2 ( logits , sequence_len , beam_width = beam_width , top_paths = top_paths ) decode_result_recovery_blank_id = [ ctc_utils . labels_last_to_blankid ( single_decode_result , blank_id ) for single_decode_result in decode_result ] decode_result_dense = [ tf . sparse_tensor_to_dense ( result , default_value = blank_id ) for result in decode_result_recovery_blank_id ] return decode_result_dense , probs