A convolutional stack outputs a 4D block and the dense layer after it wants a matrix. The reshape between them is one line, and the off-by-one version of it silently scrambles your data instead of failing.
Write flatten_batch(x).
x has shape (n, h, w, c): n images, each h by w with c channels. Return an array of shape (n, h w c) where row i is image i laid out flat.
You have read the opening. The rest is free with a Bezen account, and no card is needed.
Behind the sign-in