C/C++ Code generation for Alexnet without GPU

Hello,
I am a hardware guy with little knowlwdge on machine learning thing. I need pure C/C++ code for Alexnet , I am trying to generate the C/C++ code for the alexnet using MATLAB C Coder, but fail to do so.
*my pc does does not have GPU or NVIDIA drivers or libraries etc.
here is my entry function:
function out = alexnet_classify(in)
persistent mynet;
if isempty(mynet)
mynet = coder.loadDeepLearningNetwork('alexnet', 'myalexnet');
out = mynet.predict(in);
end
I am getting the following error:
coder.loadDeepLearningNetwork is only supported for GPU code generation.
please help me

1 件のコメント

Raymond Norris
Raymond Norris 2020 年 10 月 19 日
Hi Haroon,
Just a quick note, your if statement actually includes the assignment to out, since it requires the end statement. So it really looks like this.
function out = alexnet_classify(in)
persistent mynet;
if isempty(mynet)
mynet = coder.loadDeepLearningNetwork('alexnet', 'myalexnet');
out = mynet.predict(in);
end
Which means if you've already called this code once (and therefore mynet is now initalized) you won't get out assigned. I suspect you want
function out = alexnet_classify(in)
persistent mynet;
if isempty(mynet)
mynet = coder.loadDeepLearningNetwork('alexnet', 'myalexnet');
end
out = mynet.predict(in);
end
This doesn't address your question (which is why I'm only marking it as a Comment).
Raymond

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

2020 年 10 月 19 日

コメント済み:

2020 年 10 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by