Tensorflow不可损坏类型:“list”

2024-06-16 10:55:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我是Tensorflow的新手(实际上是机器学习),我正在跟踪 在https://github.com/seyedsaeidmasoumzadeh/Predict-next-word/blob/master/main.py中的代码,我对该代码所做的更改是在最后保存模型
saver.save(sess, 'C:\\Naresh\\SpecialProject\\MachineLearning-II\\Model\\RNN_WordPrediction\\Model')

现在我想使用保存的模型来预测新词,但是我得到了一个错误:

pred = sess.run(Prediction, feed_dict={X:x})
TypeError: unhashable type: 'list' 

下面是用保存的模型预测下一个单词的代码,你能帮我吗。在

^{pr2}$

你知道怎么解决这个问题吗?在


Tags: 代码https模型githubcom机器modeltensorflow
1条回答
网友
1楼 · 发布于 2024-06-16 10:55:24

如果将[below1]更改为[below2],它将工作正常。在

[below1]
X = tf.get_collection('input:0')

[below2]
X = tf.get_collection('input:0')[0]

相关问题 更多 >