Custom layer/reshape fully connected layer

조회 수: 21 (최근 30일)
Rahmawati Rahmawati
Rahmawati Rahmawati 2021년 4월 28일
답변: Divya Gaddipati 2021년 5월 10일
I am currently working in encoder decoder architecture but I have to use fully connected layer. Turns out it gains an error because the vector size is becoming 1D after fully connected layer. Before entering into decoder part I need to reorganize into original matrix for example 100x100x3. Is there any hints how to handle this issue?

채택된 답변

Divya Gaddipati
Divya Gaddipati 2021년 5월 10일
While there is no built-in 'Reshape' layer to convert the output from the fully connected layer, you can define a custom layer that can act as a reshaping layer after the fully connected layer. For more information on creating custom layers (refer to the 'Intermediate Layer Template' in the 'Layer Templates' section), refer to the following documentation link:
You can set up the layer to reshape the output from the fully connected layer to a 2D matrix in the 'predict' method and vice versa in the 'backward' method. The other methods are optional and you can leverage them based on your use case. MATLAB provide a 'reshape' function that you could use to perform these operations:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by