我正在尝试使用tfLearn运行lstm模型,但出现此错误:

File "...city_names.py", line 16, in <module>
g = tflearn.lstm(g, 256, activation='relu', return_seq=True)
File "...\tflearn\layers\recurrent.py", line 197, in lstm
inference = tf.unpack(inference)
AttributeError: module 'tensorflow' has no attribute 'unpack'

与以下行:
g = tflearn.input_data(shape=[None, maxlen, len(char_idx)])

这些是代码行:
path = "US_cities.txt"
maxlen = 20
X, Y, char_idx = textfile_to_semi_redundant_sequences(path, seq_maxlen=maxlen, redun_step=3)
g = tflearn.input_data(shape=[None, maxlen, len(char_idx)])
g = tflearn.input_data(shape=[None, maxlen, len(char_idx)])

最佳答案

在tf 1.0中,没有unpack。您可能要改用unstack
要升级以前的代码,可以参考https://www.tensorflow.org/install/migration
但是我不知道是否有用于更新整个深度学习库的工具,例如tflearn = =

关于tensorflow - AttributeError:模块'tensorflow'没有属性'unpack',我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42315234/

10-12 19:33