mkl-dnn code generation failed with Index exceeding error

3 ビュー (過去 30 日間)
Mimsik Seo
Mimsik Seo 2020 年 3 月 5 日
Hi, I'm trying to make mex function with my pretrained network.
But I ran into this error msg:
??? Error generating code for network net_0. Index exceeds the number of array elements (0).
My SeriesNetwork object has layers as:
1 'input_6' Image Input 1x1x2 images
2 'conv2d_transpose_8' Transposed Convolution 32 4x4x2 transposed convolutions with stride [4 4] and cropping 'same'
3 'batch_normalization_20' Batch Normalization Batch normalization with 32 channels
4 're_lu_8' ReLU ReLU
5 'conv2d_transpose_9' Transposed Convolution 64 4x4x32 transposed convolutions with stride [2 2] and cropping 'same'
6 'batch_normalization_21' Batch Normalization Batch normalization with 64 channels
7 're_lu_9' ReLU ReLU
8 'conv2d_transpose_10' Transposed Convolution 128 4x4x64 transposed convolutions with stride [2 2] and cropping 'same'
9 'batch_normalization_22' Batch Normalization Batch normalization with 128 channels
10 're_lu_10' ReLU ReLU
11 'conv2d_transpose_11' Transposed Convolution 256 4x4x128 transposed convolutions with stride [2 2] and cropping 'same'
12 'batch_normalization_23' Batch Normalization Batch normalization with 256 channels
13 're_lu_11' ReLU ReLU
14 'conv2d_14' Convolution 1 4x4x256 convolutions with stride [1 1] and padding 'same'
15 'conv2d_14_tanh' Tanh Hyperbolic tangent
And I have a function:
function out = microstructure_generator(in)
persistent net
if isempty(net)
net = coder.loadDeepLearningNetwork('MSGen_z2_no_cond.mat', 'net');
end
out = net.predict(in);
Finally, I executed the following commands just like in the example above.
cfg = coder.config('mex');
cfg.TargetLang = 'C++';
cfg.DeepLearningConfig = coder.DeepLearningConfig('mkldnn');
codegen -config cfg microstructure_generator -args {ones(1,1,2,'single')} -report
I tried with adding an output layer or something, but nothing worked.
I think the error msg does not have enough information about the error. I don't get the reason for this. Please help me...

回答 (1 件)

Chaitanya Mallela
Chaitanya Mallela 2020 年 3 月 9 日
Save the DAG network as .mat file
Try Codegen by modifying isempty function
function out = microstructure_generator(in)
persistent net
if isempty(net)
net = coder.loadDeepLearningNetwork('MSGen_z2_no_cond.mat');
end
out = net.predict(in);
  2 件のコメント
sruthi gundeti
sruthi gundeti 2020 年 9 月 15 日
編集済み: sruthi gundeti 2020 年 9 月 15 日
I am facing the same issue , Did you get the solution ?
Naga Sai Pavan Swaroop Ainapurapu
Naga Sai Pavan Swaroop Ainapurapu 2022 年 7 月 7 日
same here. Did you find a solution?

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

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by