我是 tf. 我已经使用 tensorflow 训练了一个编码器 - 解码器。该程序将一个单词作为输入并打印出它的音素。例如:Hello World -> ['h', 'E', 'l', '"', '@U', ' ', 'w', '"', '3`', 'r', ' 5', 'd']我想获得所选每个音素的预测概率。在预测部分,我使用的代码如下:def predict(words, sess): if len(words) > hp.batch_size: after = predict(words[hp.batch_size:], sess) words = words[:hp.batch_size] else: after = [] x = np.zeros((len(words), hp.maxlen), np.int32) # 0: <PAD> for i, w in enumerate(words): for j, g in enumerate((w + "E")[:hp.maxlen]): x[i][j] = g2idx.get(g, 2) preds = np.zeros((len(x), hp.maxlen), np.int32) for j in range(hp.maxlen): xpreds = sess.run(graph.preds, {graph.x: x, graph.y: preds}) preds[:, j] = xpreds[:, j]提前谢谢你!我的主要问题是这些概率“隐藏”在哪里以及如何访问它们。例如,单词“Hello”中的字母“o”被映射到音素“@U”。我想知道“@U”被选为理想音素的概率是多少。
添加回答
举报
0/150
提交
取消