Search code examples
tensorflowtflearn

AttributeError: module 'tensorflow' has no attribute 'unpack'


I am trying to run a lstm model using tfLearn and I get this error:

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'

with the following line:

g = tflearn.input_data(shape=[None, maxlen, len(char_idx)])

These are the lines of code:

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)])

Solution

  • In tf 1.0, there's no unpack. You may want to use unstack instead. To upgrade previous code, you can refer to https://www.tensorflow.org/install/migration. But I don't know if there's a tool for updating an entire deep learning library such like tflearn = =