mkl-dnn code generation failed with Index exceeding error

15 visualizaciones (últimos 30 días)
Mimsik Seo
Mimsik Seo el 5 de Mzo. de 2020
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...

Respuestas (1)

Chaitanya Mallela
Chaitanya Mallela el 9 de Mzo. de 2020
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 comentarios
sruthi gundeti
sruthi gundeti el 15 de Sept. de 2020
Editada: sruthi gundeti el 15 de Sept. de 2020
I am facing the same issue , Did you get the solution ?
Naga Sai Pavan Swaroop Ainapurapu
Naga Sai Pavan Swaroop Ainapurapu el 7 de Jul. de 2022
same here. Did you find a solution?

Iniciar sesión para comentar.

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by