Is your batch size 10?
21504 is 21 (the number of output kernels/channels from your last conv dimension) * 32 (h_kernel) * 32 (w_kernel). I think that should be the size of your linear layers. You should calculate the width and height of kernel using formulae you can find online. Also, that 21 from the last conv does not need to be the number of classes you have, you can put 128 for example.
Let me know how it works