2
$\begingroup$

One can read everywhere on internet or in books that in convoluted neural networks, between convolution layers and the first fully connected layer, you should flatten your data.

I managed to understand that Dense layer (=first fully connected layer) requires 1d (= flattened = linearized) data.

However, I failed to figure out WHY dense layer specificaly requires 1d data.

Could you share your explanation if you have a didactical one?

$\endgroup$
1
  • 2
    $\begingroup$ It’s just a way to visualize what’s going on that gets coded into the software. You can take a 2D array to a fully-connected layer with no issue (in terms of the math, not necessarily the software). Try drawing it out. This drawing might help you understand what’s going on in a convolutional neural network. You could draw the layer fully-connected with no issue. $\endgroup$
    – Dave
    Jul 5, 2021 at 16:52

1 Answer 1

3
$\begingroup$

Requiring a fully connected layer to only accept one dimensional (a vector) makes for a consistent interface between layers. Strict inputs makes the the code more straightforward. Otherwise a fully interconnected layer might have to accept arbitrary inputs (e.g., n-dimensional).

$\endgroup$
1
  • $\begingroup$ Hello @Brian Spiering! Thanks for your answer. I am not entirely sure to understand what you mean by "Strict inputs makes the code more straifghforward". Could you clarify ? Thank you ! $\endgroup$ Jul 6, 2021 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.