← Questions

Debug a shape mismatch in a PyTorch U-Net

0
AppleCodingLast asked Mar 2026

A U-Net written in PyTorch fails with a tensor shape mismatch. Find the cause (typically where skip connections are concatenated with upsampled features whose size no longer matches after pooling and convolutions), fix it, and explain how you would make the model work for any input size.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding