public static extern NNTrainerError ConstructWithConf(string model_conf, out IntPtr model_handle);
/* int ml_train_model_compile_with_params(ml_train_model_h model, const char *params) */
- [DllImport(Libraries.Nntrainer, EntryPoint = "ml_train_model_compile_with_params")]
+ [DllImport(Libraries.Nntrainer, EntryPoint = "ml_train_model_compile_with_single_param")]
public static extern NNTrainerError Compile(IntPtr model_handle, string compile_params);
+
+ /* int ml_train_model_run(ml_train_model_h model, ...) */
+ [DllImport(Libraries.Nntrainer, EntryPoint = "ml_train_model_run_with_single_param")]
+ public static extern NNTrainerError Run(IntPtr model_handle, string run_params);
}
}
string compile_params = null;
if (hyperparameter != null) {
- compile_params = string.Join("`", hyperparameter);
+ compile_params = string.Join("|", hyperparameter);
Log.Info(NNTrainer.Tag, "Compile hyperparameter:"+ compile_params);
}
NNTrainerError ret = Interop.Model.Compile(_handle, compile_params);
NNTrainer.CheckException(ret, "Failed to compile model");
}
+
+ /// <summary>
+ /// Trains the neural network model with the hyperparameter.
+ /// </summary>
+ /// <remarks>
+ /// Use this function to train the compiled neural network model with
+ /// the passed training hyperparameters. This function will return once the
+ /// training, along with requested validation and testing, is completed.
+ /// </remarks>
+ /// <param name="hyperparameter">Hyperparameters for train model.</param>
+ /// <since_tizen> 10 </since_tizen>
+ public void Run(params string[] hyperparameter)
+ {
+ string run_params = null;
+
+ if (hyperparameter != null) {
+ run_params = string.Join("|", hyperparameter);
+ Log.Info(NNTrainer.Tag, "Run hyperparameter:"+ run_params);
+ }
+
+ NNTrainerError ret = Interop.Model.Run(_handle, run_params);
+ NNTrainer.CheckException(ret, "Failed to run model");
+ }
+
}
}