C4W4 help (incompatible shapes)

This assignment is giving me this trouble. (There was a problem grading your submission. Details:
Incompatible shapes: [1150,64] vs. [1150] [Op:SquaredDifference])

I have had a similar issue with C3W4. There was a conflict of shapes. These two assignments are the last two left to complete this whole certificate program.

Can anyone please help?

I would appreciate it.

im having the same problem please let me know if you found something

Nope. I am getting no help for a long time. I expected this community to be more helpful than this :frowning:

I am also facing the same problem…
Can any one help me


Send me your notebook via dm such that I can check where it went wrong.By clicking on the profile picture, you will see an option to message.There you can attach your notebook.
Then we can discuss the issues here, under the topic you created.

With regards,
Nilosree Sengupta

I am sending the ipynb file. please check it.



Under def parse_data_from_file(filename):
There are already 2 lists made for times and temperature.
You have again created 2 more lists.Though this won’t affect the output but will unnecessarily increase the space complexity.

Under def create_uncompiled_model():

It’s given in the hint :

  1. Lambda layers are not required.
  2. Use a combination of Conv1D and LSTM layers followed by Dense layers

Whereas you have :

  1. used Lambda layers.
  2. and you have written a lot more things which are not needed.

Under def create_compiled_model():

  1. you have again defined the architecture and also used Lambda layers. But This function is just for compilation.

It’s written in the hint that : Notice that you are reusing the architecture you defined in the create_uncompiled_model earlier. Now you only need to compile this model using the appropriate loss, optimizer (and learning rate).

  1. You have used SGD. Try using Adam with the default learning rate.
    Next hint given :

This is a common problem if you use SGD as an optimizer and set a learning rate that is too high. If you encounter this problem consider lowering the learning rate or using Adam with the default learning rate.

There are more wrong parameters used in your notebook.

Being a mentor, I can’t directly say all the parameters, but I will suggest you to read the hints properly, read what is asked under which function.

From your notebook it seems that you are quite confused under every function what parameters to be used. You can also go through the specific parts of the course where it’s taught about parameters.Such that you can understand which one to use when.

Hope this helps.

With regards,
Nilosree Sengupta


You are not supposed to post your code on community publicly such that the code is not directly visible to the other learners, so that they get the opportunity to code on their own, as per the community guidelines.
Hence, I am removing it.

From next time, whenever assistance is need, feel free to post on discourse , we all are here to help you.But kindly send the notebook to mentors via dm only.Then discuss the issues on discourse under the respective post.

With regards,
Nilosree Sengupta

“But kindly send the notebook to mentors via dm only.” – How to send the code to a mentor only? I don’t know. So how to send notebook via dm only.

Thank you. I am trying again…


It seems you are replying through email. You need to come to community at first. Then, you can send your notebook to any mentor by clicking on the profile picture of any mentor, you will see an option to message.There you can attach your notebook as attachment.

With regards,
Nilosree Sengupta

You’re Welcome @SUDIP_KUMAR_DE !!
Happy Learning!!

With regards,
Nilosree Sengupta

Thank you for your valuable suggestions…
I have solved the assignment using Adam() with little bit change in code…
Thank you once again


That’s great !
You are welcome !
Happy learning !

With regards,
Nilosree Sengupta

Hello @nilosreesengupta,

I am having the same problem stated above. I went ahead to read this thread. I have what you are suggesting already in place but still have the same incompatible shapes issue. Can you please help?

Hello @Joachim_Asare ,

I have gone through your notebook.

There are certain issues.
Example :
Under # GRADED FUNCTION: create_uncompiled_model() :
You have taken only 1 LSTM layer.
2 LSTM layers are needed.

And there are few more parameters and values which are not right, which will be very specific if I say all of them, and being a mentor I cannot say specifically.

You can revise once , read about where to take which parameters and I would suggest you to read the hints thoroughly, that generally solves majority of the problems.

With regards,
Nilosree Sengupta

1 Like