Code Generation for Prediction of Machine Learning Model

2 ビュー (過去 30 日間)
Inna Pelloso
Inna Pelloso 2022 年 7 月 26 日
回答済み: Fred Smith 2022 年 8 月 24 日
Hi,
I have auto-generated C++ code using Matlab Coder for a machine learning model, that has a 1x27 double as input. Is there anyway to change the way some of the C++ is generated? Specifically, is there any way to #define the number of inputs (27 in this case) and just use the definition inside the auto-generated code (as opposed to the way 27 is being referenced multiple times, since it is breaking my API)?
Any help would be appreciated!
IP
static void main_prediction_mdl()
{
real_T dv[27];
real_T prediction_mdl;
// Initialize function 'prediction_mdl' input arguments.
// Initialize function input argument 'X'.
// Call the entry-point 'prediction_mdl'.
argInit_1x27_real_T(dv);
prediction_mdl = prediction_mdl(dv);
}

採用された回答

Fred Smith
Fred Smith 2022 年 8 月 24 日
Hi Inna,
If you make the input to the network variable-sized that will produce generic code. You can use coder.varsize to make a fixed-size input variable-sized.
In general there is no support for producing fixed-size code whose size is parametrized by a #define in MATLAB Coder today.
Cheers,
Fred

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB Coder についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by