* 9")
*/
int ml_train_model_compile_with_single_param(ml_train_model_h model,
+ const char *single_param);
+
+/**
+ * @brief Trains the neural network model with params.
+ * @details 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.
+ * @since_tizen 7.0
+ * @param[in] model The NNTrainer model handle.
+ * @param[in] single_param Hyperparameters for train model.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Invalid parameter.
+ * API to solve va_list issue of Dllimport of C# interop.
+ * The input format of single_param must be 'key = value' format, and it
+ * received as shown in the example below. delimiter is '|'. e.g)
+ * ml_train_model_run_with_single_param(model, "epochs=2 | batch_size=16")
+ */
+int ml_train_model_run_with_single_param(ml_train_model_h model,
+ const char *single_param);
#if defined(__TIZEN__)
/**
return status;
}
-static std::vector<std::string> split_param(std::string singgle_param,
+static std::vector<std::string> split_param(std::string single_param,
char delimiter) {
std::vector<std::string> param_list;
- std::stringstream sstream(singgle_param);
+ std::stringstream sstream(single_param);
std::string param;
while (std::getline(sstream, param, delimiter))
return status;
}
+int ml_train_model_run_with_single_param(ml_train_model_h model,
+ const char *single_param) {
+
+ std::vector<std::string> param_list;
+
+ check_feature_state();
+ ML_TRAIN_VERIFY_VALID_HANDLE(model);
+
+ if (single_param)
+ param_list = split_param(single_param, '|');
+
+ return nntrainer_model_run(model, param_list);
+}
+
+int ml_train_model_run(ml_train_model_h model, ...) {
+ int status = ML_ERROR_NONE;
+ ml_train_model *nnmodel;
+ const char *data;
+ std::shared_ptr<ml::train::Model> m;
+
+ check_feature_state();
+
+ ML_TRAIN_VERIFY_VALID_HANDLE(model);
+
+ std::vector<std::string> arg_list;
+ va_list arguments;
+ va_start(arguments, model);
+
+ while ((data = va_arg(arguments, const char *))) {
+ arg_list.push_back(data);
+ }
+
+ va_end(arguments);
+
+ return nntrainer_model_run(model, arg_list);
+}
+
int ml_train_model_destroy(ml_train_model_h model) {
int status = ML_ERROR_NONE;
ml_train_model *nnmodel;