mkl-dnn code generation failed with Index exceeding error
3 ビュー (過去 30 日間)
古いコメントを表示
Hi, I'm trying to make mex function with my pretrained network.
I have followed this example: https://kr.mathworks.com/help/deeplearning/examples/deep-learning-prediction-with-intel-mkl-dnn.html
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...
0 件のコメント
回答 (1 件)
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
2020 年 9 月 15 日
編集済み: sruthi gundeti
2020 年 9 月 15 日
I am facing the same issue , Did you get the solution ?
参考
カテゴリ
Help Center および File Exchange で Deep Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!