Custom layer/reshape fully connected layer

9 次查看(过去 30 天)
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 中查找有关 Image Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by