Invalid Argument Error / Graph Execution Error

We Are Going To Discuss About Invalid Argument Error / Graph Execution Error. So lets Start this Python Article.

Invalid Argument Error / Graph Execution Error

  1. How to solve Invalid Argument Error / Graph Execution Error

    I faced the same error and tried to test everything with no value, but I heard that you have to make the number of folders in the dataset the SAME as the one in Dense.
    I don't know if this will solve your specific bug or not but try this with your code:
    vgg_model.add(tf.keras.layers.Dense(10, activation = 'softmax'))
    Replace 10 with the number of training dataset folders or can call 'classes'.

  2. Invalid Argument Error / Graph Execution Error

    I faced the same error and tried to test everything with no value, but I heard that you have to make the number of folders in the dataset the SAME as the one in Dense.
    I don't know if this will solve your specific bug or not but try this with your code:
    vgg_model.add(tf.keras.layers.Dense(10, activation = 'softmax'))
    Replace 10 with the number of training dataset folders or can call 'classes'.

Solution 1

I faced the same error and tried to test everything with no value, but I heard that you have to make the number of folders in the dataset the SAME as the one in Dense.

I don’t know if this will solve your specific bug or not but try this with your code:

vgg_model.add(tf.keras.layers.Dense(10, activation = 'softmax'))

Replace 10 with the number of training dataset folders or can call ‘classes’.

Original Author Abdelrahman Saleh Of This Content

Solution 2

Check the image size. Size of image defined in model.add(.., input_shape=(100,100,3)) should be same as the target_size=(100,100) in train_gererator.
And also check if number of neurons in last dense layer are equal to number of output classes or not.
By the way, there isn’t any need to install any other module. It is some error in code.

Original Author Harsh Sharma Of This Content

Solution 3

In my case, the reason was incompatible shapes. My model takes [batch_size, 784] image shape, but data where [batch_size, 28, 28, 1] shape. So I easily fixed it with tf.reshape(x, [-1]).

Original Author Олег Венгринюк Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment