-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
Numpy input error - list object has no attribute shape when running mnist example #214
Comments
Following |
I am having the same issue :( |
I am also facing this problem. Any solutions since initially posting? |
I am pretty sure this is because you are feeding Python array instead of Numpy array. Convert to Numpy array and then pass to tf.estimator.inputs.numpy_input_fn. |
I found the answer here ->https://stackoverflow.com/questions/57537474/how-to-fix-attributeerror-list-object-has-no-attribute-shape-error-in-pyt Try using |
Python 3.4
tensorflow 1.4
I have copied the code exactly as in example, and getting the following error.
Here is surrounding code where the error occurred:
model = tf.estimator.Estimator(model_fn)
Define the input function for training
The error:
File "/Users/tushar/workspace/python/impact/cnn.py", line 123, in run
model.train(input_fn, steps=num_steps)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/estimator/estimator.py", line 302, in train
loss = self._train_model(input_fn, hooks, saving_listeners)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/estimator/estimator.py", line 708, in _train_model
input_fn, model_fn_lib.ModeKeys.TRAIN)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/estimator/estimator.py", line 577, in _get_features_and_labels_from_input_fn
result = self._call_input_fn(input_fn, mode)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/estimator/estimator.py", line 663, in _call_input_fn
return input_fn(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/estimator/inputs/numpy_io.py", line 109, in input_fn
if len(set(v.shape[0] for v in ordered_dict_x.values())) != 1:
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/estimator/inputs/numpy_io.py", line 109, in
if len(set(v.shape[0] for v in ordered_dict_x.values())) != 1:
AttributeError: 'list' object has no attribute 'shape'
I tried the same with my own input data and made sure to convert them to numpy arrays, and then tried with the same tutorial mnist data as well. In both cases, getting this error. Unable to figure out why this error occurred with the mnist data as the code is the same as in given example.
Please help, what am I missing?
The text was updated successfully, but these errors were encountered: