Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'module' object has no attribute 'pack' #7550

Closed
haozheji opened this issue Feb 16, 2017 · 13 comments
Closed

AttributeError: 'module' object has no attribute 'pack' #7550

haozheji opened this issue Feb 16, 2017 · 13 comments
Labels
stat:awaiting response Status - Awaiting response from author stat:awaiting tensorflower Status - Awaiting response from tensorflower type:bug Bug

Comments

@haozheji
Copy link

Training images using keras with tf backend.The error shows that tf (version==0.12.head) has no attribute "pack".

Traceback (most recent call last):
  File "binary_convnets.py", line 30, in <module>
    model.add(Flatten())
  File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 324, in add
    output_tensor = layer(self.outputs[0])
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 517, in __call__
    self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 571, in add_inbound_node
    Node.create_node(self, inbound_layers, node_indices, tensor_indices)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 155, in create_node
    output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
  File "/usr/local/lib/python2.7/dist-packages/keras/layers/core.py", line 440, in call
    return K.batch_flatten(x)
  File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 862, in batch_flatten
    x = tf.reshape(x, tf.pack([-1, prod(shape(x)[1:])]))
AttributeError: 'module' object has no attribute 'pack'
@zhaopku
Copy link

zhaopku commented Feb 16, 2017

As far as I know, tf.pack has been renamed as tf.stack.

@aselle
Copy link
Contributor

aselle commented Feb 18, 2017

Yes, the keras needs to be updated since this is renamed to stack in tf 1.0.
@fchollet, what's the best way to handle this?

@aselle aselle added stat:awaiting tensorflower Status - Awaiting response from tensorflower type:bug Bug labels Feb 18, 2017
@hahnsangkim
Copy link

hahnsangkim commented Feb 20, 2017

I have the same issue. I've upgraded to tensorflow version 1.0 and then tried to run a python program that uses keras like this
from keras.models import Sequential
from keras.layers import Flatten, Dense

Update: It was actually something wrong in my code. It turns out that tf.pack is OK. I upgraded keras = 1.2.0 which still remains the same.

@aselle
Copy link
Contributor

aselle commented Feb 21, 2017

I apologize, but I'm confused now. If the issue is resolved please close it. If not, please re-state exactly what is still wrong and what you would like fixed. Thanks so much!

@aselle aselle added the stat:awaiting response Status - Awaiting response from author label Feb 21, 2017
@asif-shakeel
Copy link

I am having this problem as well. I pip installed tensorflow in anaconda with python3 environment. Can we revert anaconda to an earlier version of tensorflow to at least temporarily get around this?

@aselle
Copy link
Contributor

aselle commented Mar 3, 2017

@tawantinsuyu, unfortunately no, we won't downgrade the default version, because that would break users who already updated. To use an older version, an easy way is to use docker. You can also find the previous .whl from our web site and install that, but we don't recommend that. Good luck. Thanks!

@aselle
Copy link
Contributor

aselle commented Mar 3, 2017

Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks!

@aselle aselle closed this as completed Mar 3, 2017
@xiezhongzhao
Copy link

I have the same problem, my version of tensorflow is 1.0.1, I changed the 'pack' into 'stack', but it did't work. I hope you can help me @zhaopku

@navoj
Copy link

navoj commented May 11, 2018

In page 105 of the book https://www.scribd.com/read/365181872/Building-Machine-Learning-Projects-with-TensorFlow# it also has a call to 'pack' that does not work with the latest version of Tensorflow.

@renelikestacos
Copy link

renelikestacos commented Jul 3, 2018

I had the same issue with TensorFlow. When i tried it in PyCharm it worked. Firstly I thought uninstall and install keras solved it. Still have the same error at Jupyter Notebook (Python 3.6)

@Somayeh12
Copy link

Any solution to this problem? I am having the same problem. tensorflow 1.13, python 3.6.
I replaced tf.pack with tf.stack, but the output of tf.stack is different than tf.pack.
Any solution?

@krishna0890227
Copy link

We can replace tf.pack() with tf.stack in Jupyter Notebook as well.

@ShauryaUppal-1Mg
Copy link

Any solution to this problem? I am having the same problem. tensorflow 1.13, python 3.6.
I replaced tf.pack with tf.stack, but the output of tf.stack is different than tf.pack.
Any solution?

How did you solve this issue? I am facing same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response Status - Awaiting response from author stat:awaiting tensorflower Status - Awaiting response from tensorflower type:bug Bug
Projects
None yet
Development

No branches or pull requests