I am new to tf. I have trained an encoder - decoder using tensorflow. The program takes as input a word and prints out its phonemes.
For example: Hello World -> ['h', 'E', 'l', '"', '@U', ' ', 'w', '"', '3`', 'r', '5', 'd']
I would like to have access to the prediction probability of each phoneme chosen.
In the prediction section, the code I am using is the following:
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]
Thank you in advance!
My main problem is where these probabilities are "hidden" and how to access them. For example, the letter "o" in the word "Hello" was mapped with the phoneme "@U". I would like to find out with what probability "@U" was chosen as the ideal phoneme.