"The value of 'Layer' is invalid. Layers that require formatted dlarray inputs are not supported." - Why is this error shown when checked the validity of a custom layer?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I be created a customized layer based on attention mechanism for deep learning application using https://in.mathworks.com/help/deeplearning/ug/define-custom-deep-learning-layer.html. But while checking the validity of layer using the following code:
layer=CoAtten(Name="atten");
validInputSize = [1 14 1024];
layout = networkDataLayout(validInputSize,"CBT");
layer = initialize(layer,layout);
checkLayer(layer,validInputSize,ObservationDimension=3)
The last line (checkLayer) shows the error like this- ""The value of 'Layer' is invalid. Layers that require formatted dlarray inputs are not supported."
What this error shows? Is the custom layer is invalid? I have used stripdims inside the predict fuction while creating the layer. Is it due to this?
0 commentaires
Réponse acceptée
Venu
le 11 Déc 2023
The error while using checkLayer "The value of 'Layer' is invalid. Layers that require formatted dlarray inputs are not supported" occurs when the custom layer's predict function does not handle the dlarray inputs correctly. Your inference is correct. In your case, when using "stripdims", it's important to ensure that the input dlarray aligns with the expected input format. This includes verifying the dimensions and data type of input dlarray.
Find the documentation below for dlarray, checkLayer and stripdims to ensure that your custom layer's predict function aligns with the expected input format.
Hope this helps!
7 commentaires
Venu
le 14 Déc 2023
Make sure that the "CoAtten.m" file is included with the saved network and is on the MATLAB path or in the current working directory when loading the network on any system. Check the initialize() function of your "CoAtten" class to ensure that it does not rely on external variables or states that might not be available when loading the network. The method should be self-contained.
You can try adding error handling in the initialize() function to catch any issues.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Image Data Workflows 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!