Not sure what I’ve done wrong in this U-Net architecture

Hello, I’ve been looking for the error in my code for hours, but I can’t find it. For some reason the input into the first upsampling block is of the wrong dimension, and I’m not sure how that happened. I would really appreciate it if someone could help me out on this.

@adam.ouertani welcome to the community !

However, please keep in mind posting your code directly is against the rules of the forum and a mod will likely remove it.

That said, having had a look, I would re-read this note from the assignment instructions very carefully:

    # Note that you must use the second element of the contractive block i.e before the maxpooling layer. 
    # At each step, use half the number of filters of the previous block 

Does it mention anything about the ‘ublocks’ here (in terms of what index to reference) ?

Hope that hint helps.

*I would also add, if this error is happening on your first ublock, your error could still be ‘upstream’ somewhere. You are allowed to post a screenshot of your error codes and so if you still have an issue please post that. It also provides us with much better troubleshooting information.

Hi, apologies for the mistake and thank you for your help. I replaced my code image with the error code, hopefully that’s in alignment with the forum rules now.

@adam.ouertani No worries, not a big deal :smiley: It is your first post here, and honestly it happens all the time so just FYI.

I hope my hint helps a little… I don’t want to just give you the answer, but can say you are very, very close to the solution, so consider what I suggested.

Consider, does
A = A[0] ?