Custom layer/reshape fully connected layer

9 visualizaciones (últimos 30 días)
Rahmawati Rahmawati
Rahmawati Rahmawati el 28 de Abr. de 2021
Respondida: Divya Gaddipati el 10 de Mayo de 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?

Respuesta aceptada

Divya Gaddipati
Divya Gaddipati el 10 de Mayo de 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:

Más respuestas (0)

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by