code generation for custom layer 'PatchEmbedding' for target 'none' is not supported as it returns a dlarray object with data format'SCB' as output 'out'

9 visualizaciones (últimos 30 días)

Respuesta aceptada

Akanksha
Akanksha el 21 de Nov. de 2025
Hi 素蓬,
This error occurs because code generation does not support custom layers that return dlarray objects with data format SCB (Sequence, Channel, Batch). The PatchEmbedding layer in Vision Transformers outputs dlarray with SCB, which is currently unsupported for target 'none'.
You can try out these following troubleshooting steps -
  • Use predict in MATLAB onlyRun inference in MATLAB without generating code.
  • Convert output to numeric arrayInside your custom layer, convert dlarray to single or double before returning:
out = extractdata(out);
This removes dlarray formatting but may break downstream layers.
  • Avoid unsupported formatsIf code generation is required, design layers to output supported formats.
Kindly refer the following links for further information -
Hope this helps!

Más respuestas (1)

素蓬
素蓬 el 21 de Nov. de 2025
give a example of code generation of transformer in matlab R2025a

Categorías

Más información sobre Deep Learning with GPU Coder en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by