- Add GetSummary(NNTrainerSummaryType verbosity, out string retSummary) to Model
- Add ml_train_model_get_summary() to interop
- Add NNTrainerSummaryType to Commons.cs
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
/* 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);
+
+ /* int ml_train_model_get_summary(ml_train_model_h model, ml_train_summary_type_e verbosity, char **summary) */
+ [DllImport(Libraries.Nntrainer, EntryPoint = "ml_train_model_get_summary")]
+ public static extern NNTrainerError GetSummaryUtil(IntPtr model_handle, NNTrainerSummaryType verbosity, out string summary);
}
}
InvalidOperation = ErrorCode.InvalidOperation
}
+
+ /// <summary>
+ /// Enumeration for the neural network summary verbosity of NNTrainer.
+ /// </summary>
+ /// <since_tizen> 10 </since_tizen>
+ public enum NNTrainerSummaryType
+ {
+ /// <summary>
+ /// Overview of model summary with one-line layer information
+ /// </summary>
+ Model = 0,
+ /// <summary>
+ /// Detailed model summary with layer properties
+ /// </summary>
+ Layer = 1,
+ /// <summary>
+ /// Model summary layer's including weight information
+ /// </summary>
+ Tensor = 2
+ }
+
internal static class NNTrainer
{
{
// release managed object
}
-
// release unmanaged object
if (_handle != IntPtr.Zero)
{
NNTrainer.CheckException(ret, "Failed to run model");
}
+ /// <summary>
+ /// Gets the summary of the neural network model.
+ /// </summary>
+ /// <remarks>
+ /// Use this function to get the summary of the neural network model.
+ /// </remarks>
+ /// <param name="verbosity">Verbose level of the summary.</param>
+ /// <param name="retSummary">On return, a string value. The summary of the current model. Avoid logic to parse and exploit summary if possible.</param>
+ /// <since_tizen> 10 </since_tizen>
+ public void GetSummaryUtil(NNTrainerSummaryType verbosity, out string retSummary)
+ {
+ NNTrainerError ret = Interop.Model.GetSummaryUtil(_handle, verbosity, out string summary);
+ NNTrainer.CheckException(ret, "Failed to get summary");
+
+ retSummary = summary;
+
+ }
}
}