logo
down
shadow

How to fix 'AttributeError: 'list' object has no attribute 'shape'' error in python with Tensorflow / Keras when loading


How to fix 'AttributeError: 'list' object has no attribute 'shape'' error in python with Tensorflow / Keras when loading

By : user3100786
Date : January 12 2021, 09:11 PM
hop of those help? Im trying to save my Model in Keras and then load it but when it try to use the loaded Model it trows an Error , Try using
code :
nmodel.predict(x_test)
nmodel.predict([x_test])


Share : facebook icon twitter icon
TensorFlow: AttributeError: 'Tensor' object has no attribute 'shape'

TensorFlow: AttributeError: 'Tensor' object has no attribute 'shape'


By : Christopher Murphy
Date : March 29 2020, 07:55 AM
I wish this helpful for you UPDATE: Since TensorFlow 1.0, tf.Tensor now has a tf.Tensor.shape property, which returns the same value as tf.Tensor.get_shape().
code :
train_data = tf.reshape(train_data, [400, 1])
print "train_data.shape: " + str(train_data.get_shape())
AttributeError: module 'tensorflow.python.keras.api._v2.keras.backend' has no attribute 'set_image_dim_ordering'

AttributeError: module 'tensorflow.python.keras.api._v2.keras.backend' has no attribute 'set_image_dim_ordering'


By : Georgi Kanchev
Date : March 29 2020, 07:55 AM
With these it helps You are mixing tf.keras and keras in your imports (they aren't compatible), and keras does not currently support tensorflow 2.0 (no stable version has been released).
If you have to use tensorflow 2.0, then you have to use tf.keras included in that version. If you want to use keras, then you need to downgrade to a stable tensorflow version.
AttributeError: 'list' object has no attribute 'shape' , how sould i fix this type of error?

AttributeError: 'list' object has no attribute 'shape' , how sould i fix this type of error?


By : user3104449
Date : March 29 2020, 07:55 AM
To fix the issue you can do You have to convert the list into numpy array and then You can use the shape attribute.
code :
import numpy as np
def comuteFinalGrades(grades):
    grades=np.array(grades)
    a=[]
    N, M = grades.shape
AttributeError: module 'tensorflow.python.keras.backend' has no attribute 'get_graph'

AttributeError: module 'tensorflow.python.keras.backend' has no attribute 'get_graph'


By : MoneySmile
Date : March 29 2020, 07:55 AM
wish help you to fix your issue The project yolov3 model for object detection has some issues with versions. I had the same issue and I used tensorflow 1.14.0 and keras 2.2.0
Just overwrite the specific versions. Write in the command line
code :
pip install tensorflow==1.14.0
pip install keras==2.2.0
Error when using Keras for transfer learning: AttributeError: 'list' object has no attribute 'dtype'

Error when using Keras for transfer learning: AttributeError: 'list' object has no attribute 'dtype'


By : Gökhan Baylan
Date : March 29 2020, 07:55 AM
To fix this issue The problem is with the line x = base_model.outputs. base_model.outputs is a list containing the output tensors of base_model, but GlobalAveragePooling2D expects a single tensor as its input.
code :
print(base_model.outputs)
[<tf.Tensor 'mixed10/concat:0' shape=(?, ?, ?, 2048) dtype=float32>]

print(base_model.output)
Tensor("mixed10/concat:0", shape=(?, ?, ?, 2048), dtype=float32)
Related Posts Related Posts :
  • Tuning the hyperparameter with gridsearch results in overfitting
  • some coordinates that I extracted from geocoder in Python are not saving in the variable I created
  • 7C in cs circles- python Im not sure what is wrong with this yet
  • python - thread`s target is a method of an object
  • Retrieve Variable From Class
  • What is the reason for matplotlib for printing labels multiple times?
  • Why would people use ThreadPoolExecutor instead of direct function call?
  • When clear_widgets is called, it doesnt remove screens in ScreenManager
  • Python can't import function
  • Pieces doesn't stack after one loop on my connect4
  • How to change font size of all .docx document with python-docx
  • How to store a word with # in .cfg file
  • How to append dictionaries to a dictionary?
  • How can I scrape text within paragraph tag with some other tags then within the paragraph text?
  • Custom entity ruler with SpaCy did not return a match
  • Logging with two handlers - one to file and one to stderr
  • How to do pivot_table in dask with aggfunc 'min'?
  • This for loop displays only the last entry of the student record
  • How to split a string by a specific pattern in number of characters?
  • Python 3: how to scrape research results from a website using CSFR?
  • Setting the scoring parameter of RandomizedSeachCV to r2
  • How to send alert or message from view.py to template?
  • How to add qml ScatterSeries to existing qml defined ChartView?
  • Django + tox: Apps aren't loaded yet
  • My css and images arent showing in django
  • Probability mass function sum 2 dice roll?
  • Cannot call ubuntu 'ulimit' from python subprocess without using shell option
  • Dataframe Timestamp Filter for new/repeating value
  • Problem with clicking select2 dropdownlist in selenium
  • pandas dataframe masks to write values into new column
  • How to click on item in navigation bar on top of page using selenium python?
  • Add multiple EntityRuler with spaCy (ValueError: 'entity_ruler' already exists in pipeline)
  • error when replacing missing ')' using negative look ahead regex in python
  • Is there a way to remove specific strings from indexes using a for loop?
  • select multiple tags by position in beautifulSoup
  • pytest: getting AttributeError: 'CaptureFixture' object has no attribute 'readouterror' capturing stdout
  • Shipping PyGObject/GTK+ app on Windows with MingW
  • Python script to deduplicate lines in multiple files
  • How to prevent window and widgets in a pyqt5 application from changing size when the visibility of one widget is altered
  • How to draw stacked bar plot from df.groupby('feature')['label'].value_counts()
  • Python subprocess doesn't work without sleep
  • How can I adjust 'the time' in python with module Re
  • Join original np array with resulting np array in a form of dictionary? multidimensional array? etc?
  • Forcing labels on histograms in each individual graph in a figure
  • For an infinite dataset, is the data used in each epoch the same?
  • Is there a more efficent way to extend a string?
  • Is it possible to do this loop in a one-liner?
  • invalid literal for int() with base 10: - django
  • Why does my code print a value that I have not assigned as yet?
  • the collatz func in automate boring stuff with python
  • How to find all possible combinations of parameters and funtions
  • about backpropagation deep neural network in tensorflow
  • Sort strings in pandas
  • How do access my flask app hosted in docker?
  • Replace the sentence include some text with Python regex
  • Counting the most common element in a 2D List in Python
  • logout a user from the system using a function in python
  • mp4 metadata not found but exists
  • Django: QuerySet with ExpressionWrapper
  • Pandas string search in list of dicts
  • shadow
    Privacy Policy - Terms - Contact Us © festivalmusicasacra.org