Why am i getting 'Not enough input arguments?

function out = CodeNNet(in)
persistent NNet
if isempty(NNet)
NNet = coder.loadDeepLearningNetwork('NNet.mat');
end
out = predict(NNet,in);
cfg = coder.config('lib');
cfg.TargetLang = 'C++';
cfg.GenCodeOnly = true;
dlcfg = coder.DeepLearningConfig('arm-compute');
dlcfg.ArmArchitecture = 'armv8';
dlcfg.ArmComputeVersion = '20.02.1';
cfg.DeepLearningConfig = dlcfg;
codegen -args {ones(256,256,3,'single')} -config cfg CodeNNet

댓글 수: 11

Im trying to generate the C++ code for a trained neural network, but i get an error in line 8 about not enough input arguments
Jan
Jan 2021년 3월 24일
Please post a copy of the complete error message. Which function does not get enough input arguments? predict, or is in a function also, or do you call the function CodeNNet without input arguments, e.g. by starting it using the green triangle in the editor?
Gaurav Garg
Gaurav Garg 2021년 3월 27일
Hi Igancio,
Can you post a picture of the error you are facing?
Jan
Jan 2021년 3월 27일
I assume, this thread is abandoned.
Poor sad thread, unloved and abandoned.
Jan
Jan 2021년 3월 27일
I do love this thread. I do care and Gaurav does also and you, John, show your emotions as well.
Thread, we are here, if you need us.
i understand that i have no input for the function but is it possible to generate C++ code just for the Neural Network itself?
You need a prototype call to generate code, as code generation specializes the datatypes according to the prototype.
Like a script where the function is called and tested with a test input?
The
codegen -args {ones(256,256,3,'single')} -config cfg CodeNNet
should not be part of the source code, and the function name must go before the -args

댓글을 달려면 로그인하십시오.

답변 (1개)

Gaurav Garg
Gaurav Garg 2021년 3월 30일

0 개 추천

Hi,
From what seems to be the problem so far-
You should not include
codegen -args {ones(256,256,3,'single')} -config cfg CodeNNet
in your source code.

카테고리

도움말 센터File Exchange에서 Deep Learning Code Generation Fundamentals에 대해 자세히 알아보기

질문:

2021년 3월 24일

답변:

2021년 3월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by