Flatten is used in Keras for a purpose, and that is to reduce or reshape a layer to dimensions suiting the number of elements present in the Tensor.
But this has an effect, that is by flattening you may experience a reduction in parameters which disperses information across various features and because of that, a feature won’t hold much information.
If you are excited and passionate about artificial intelligence, then I would recommend you to join the Artificial intelligence course and become a certified professional.
Also, watch our YouTube video on Keras training from our experts to get-go.