Custom layer/reshape fully connected layer

15 vues (au cours des 30 derniers jours)
Rahmawati Rahmawati
Rahmawati Rahmawati le 28 Avr 2021
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?

Réponse acceptée

Divya Gaddipati
Divya Gaddipati le 10 Mai 2021
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:

Plus de réponses (0)

Catégories

En savoir plus sur Data Types dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by