Custom Deep Learning Layer with different input and output format occurs error
古いコメントを表示
When I construct the custom deep learning layer with formattable input and output, checkLayer function returns error when the input has "CBT" format and output has "SCBT" format. However, when I change the output with the same "CBT" format as input, the checkLayer function is successful. The error message is
Number of dimension labels in data format must be greater than or equal to the
number of dimensions of the data array.
I would like to know if maintaining input and output consistency in formatting is a mandatory requirement when implementing custom layers?
回答 (1 件)
Hi @Chuguang Pan,
As mentioned in the comments, this turned out to be a bug in checkLayer on R2025a, confirmed by MathWorks support — not an issue with the layer setup. The docs actually show examples of layers with different input and output formats (like taking in "SSCB" and outputting "CBT"), so what you're doing is supported; checkLayer just didn't handle it correctly in that release.
Good to know it's fixed in R2026a. For anyone stuck on R2025a in the meantime, you can sidestep checkLayer and test manually instead — make a dlarray with your input format, run it through predict, and check the output comes back with the format/dims you expect:
X = dlarray(rand(numChannels, batchSize, numTimeSteps), "CBT");
Y = predict(layer, X);
Not as thorough as checkLayer's full suite, but enough to confirm the layer works while waiting to upgrade.
カテゴリ
ヘルプ センター および File Exchange で Image Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!