Tensorflow:tf.nn.ctc_beam_search_decoder输出混乱

时间:2019-07-10 08:20:30

标签: tensorflow beam-search

我试图理解tf.nn.ctc_beam_search_decoder,所以我写了以下代码:

import tensorflow as tf
import numpy as np

mat = np.array([[1,0,0,0],[0,1,0,0],[0,0,1,0]]).reshape((3,1,4))
input_sequence = [3]
sess = tf.InteractiveSession()
decoded, _ = tf.nn.ctc_beam_search_decoder(inputs=mat, sequence_length=input_sequence)
tf.global_variables_initializer().run()
print(sess.run(decoded)[0].values)

,输出为:

[0 2]

这令人困惑。根据{{​​3}},decoded[j].values应该返回由波束搜索解码器解码的类。由于如果排除了最后一列(对应于空白字符),则输入概率矩阵是单位矩阵,因此输出类路径不应该是[0 1 2]吗?

0 个答案:

没有答案
相关问题