What is the role of “Flatten” in Keras?

前端 未结 6 1531
醉话见心
醉话见心 2020-12-07 07:51

I am trying to understand the role of the Flatten function in Keras. Below is my code, which is a simple two-layer network. It takes in 2-dimensional data of sh

6条回答
  •  情话喂你
    2020-12-07 08:08

    Flatten make explicit how you serialize a multidimensional tensor (tipically the input one). This allows the mapping between the (flattened) input tensor and the first hidden layer. If the first hidden layer is "dense" each element of the (serialized) input tensor will be connected with each element of the hidden array. If you do not use Flatten, the way the input tensor is mapped onto the first hidden layer would be ambiguous.

提交回复
热议问题