フィルターのクリア

"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?

3 ビュー (過去 30 日間)
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?

採用された回答

Venu
Venu 2023 年 12 月 11 日
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 件のコメント
Venu
Venu 2023 年 12 月 14 日
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.
BIPIN SAMUEL
BIPIN SAMUEL 2023 年 12 月 14 日
Thank You @Venu; now it worked for me.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by