inp, tar = sess.run(el)
print(tar[:1])
Вывод:
[[912 0 53 145 0 155 45 50 15 48 924 225 912 0 235 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0]]
dec_outputs = decoder(y, context_vector, hidden, batch_sz)[:1]
Вывод:
[[[-0.05515359 0.02397671 -0.0614723 ... 0.0092684 -0.0021817
-0.03101936]
[-0.07199661 0.03070245 -0.0926991 ... 0.00494846 0.00342776
-0.05146109]
[-0.05900393 0.03615921 -0.09878509 ... -0.01421204 0.01624698
-0.06125399]
...
[ 0.34236148 -0.1391055 0.19652194 ... -0.45829755 0.00265628
0.03526935]
[ 0.34237123 -0.1391213 0.19651419 ... -0.45829237 0.00266851
0.03526982]
[ 0.3423798 -0.13913548 0.19650745 ... -0.45828766 0.00267947
0.03526917]]]
То есть всё ок
Но когда передаю всё в
loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(labels= y, logits= dec_outputs))
loss_ = sess.run(loss, feed_dict= {x: inp, y: tar})
Вывод: nan
tar.shape: (6, 82)
dec_outputs.shape: (6, 82, 512)