AttributeError:模块'tensorflow'没有属性'unpack'

suk*_*uku 2 tensorflow tflearn

我试图lstm使用tfLearn 运行模型,我收到此错误:

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'
Run Code Online (Sandbox Code Playgroud)

使用以下行:

g = tflearn.input_data(shape=[None, maxlen, len(char_idx)])
Run Code Online (Sandbox Code Playgroud)

这些是代码行:

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)])
Run Code Online (Sandbox Code Playgroud)

sol*_*ice 7

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