Value error in cifar 100

Hey,
I am trying to implement convolutions on cifar 100 dataset, but after too much efforts its giving an error that shapes are incompatible.
I have done everything correct but its not working.

Before it was giving me an error that expected 4n_dim bit received 3n_dim
I also don’t understand why this errors are popping up. Pls explain

There’s no way anyone can answer your question based on the information you provided, other than to say it looks like the shapes are incompatible.

If you have “done everything correct”, you wouldn’t be getting error messages.

Maybe you could provide more information - like exactly what you mean by “implement convolutions”.

Here is the pic of my model

That all looks pretty reasonable, although I’ve usually seen people use BatchNorm2D between Conv layers, not BatchNorm1D between FC layers. One other “fine point” is that it usually works out better not to explicitly use sigmoid or softmax in the output layer, but let the cost function compute the activation and loss simultaneously by using from_logits = True mode. But that wouldn’t cause the exception you are seeing.

But you only showed us the incomplete error trace in your original post: if you look at the root of the exception stack, it should point to a particular layer where the exception happens. This is how debugging works, right? You start with the error message and look at exactly what happens where it “throws”. Then you work backwards from there to figure out where the actual error is.

Thanks for your help.
I am trying to debug it. What if it won’t work ??
What should I do??

There is no reason in principle that it shouldn’t work. You just have to find the bug(s). Of course this is just the first step: getting to the point where the model training doesn’t just throw an error. Then you may well need to fine tune the model and adjust hyperparameters, as Prof Ng has described in Course 2 in order to get a solution that really works. It is great that you are trying to apply what you learned in the course, but it’s not necessarily easy. But if you put in the effort, it should all be possible to learn.

Note that this is beyond the scope of the course. Also the mentors here are just volunteers, meaning we don’t get paid to do this. We have discretion even about questions that are legitimately about the course material: I am not required to answer any particular question. But if you ask nicely, maybe one of us can take a look at your code. :nerd_face: The purpose here is learning.

If you have “done everything correct”, you wouldn’t be getting error messages.