--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="native-nntrainer-itc" version="0.1.0" api-version="6.0">
+ <label>NativeNntrainerTest</label>
+ <author email="test@tizentest.com" href="www.tizen.org">test</author>
+ <description>Native API test Application</description>
+ <ui-application appid="native.nntrainer-itc" exec="/usr/apps/native-nntrainer-itc/bin/tct-nntrainer-native" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <background-category value="background-network"/>
+ <background-category value="download"/>
+ <background-category value="iot-communication"/>
+ <background-category value="location"/>
+ <background-category value="media"/>
+ <background-category value="sensor"/>
+ </ui-application>
+</manifest>
--- /dev/null
+SET(PKG_NAME "nntrainer")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-native")
+SET(RPM_NAME "native-${PKG_NAME}-itc")
+
+SET(CAPI_LIB "nntrainer")
+SET(TC_SOURCES
+ ITs-nntrainer-common.c
+ ITs-nntrainer-layer.c
+ ITs-nntrainer-optimizer.c
+ ITs-nntrainer-dataset.c
+ ITs-nntrainer-model.c
+)
+
+PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
+ ${CAPI_LIB}
+ capi-appfw-application
+ glib-2.0
+ bundle
+ capi-system-info
+ dlog
+ elementary
+)
+
+INCLUDE_DIRECTORIES(
+ ${${CAPI_LIB}_INCLUDE_DIRS}
+)
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.c ${TC_SOURCES} ${COMMON_FILE})
+TARGET_LINK_LIBRARIES(${EXEC_NAME}
+ ${${CAPI_LIB}_LIBRARIES}
+ bundle
+)
+
+INSTALL(PROGRAMS ${EXEC_NAME}
+ DESTINATION ${BIN_DIR}/${RPM_NAME}/bin
+)
+
+IF( DEFINED ASAN )
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -pie -g -fsanitize=address -fsanitize-recover=address -U_FORTIFY_SOURCE -fno-omit-frame-pointer")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -Wl,-fsanitize=address")
+ELSE()
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie")
+ENDIF()
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-nntrainer-common.h"
+
+/** @addtogroup itc-nntrainer
+* @ingroup itc
+* @{
+*/
+
+/**
+* @function NnTrainerGetError
+* @description Maps error enums to string values
+* @parameter nRet: error code returned
+* @return error string
+*/
+char* NnTrainerGetError(int nRet)
+{
+ char *szErrorVal = "Unknown error code";
+ switch ( nRet )
+ {
+ case ML_ERROR_NONE: szErrorVal = "ML_ERROR_NONE"; break;
+ case ML_ERROR_INVALID_PARAMETER: szErrorVal = "ML_ERROR_INVALID_PARAMETER"; break;
+ case ML_ERROR_STREAMS_PIPE: szErrorVal = "ML_ERROR_STREAMS_PIPE"; break;
+ case ML_ERROR_TRY_AGAIN: szErrorVal = "ML_ERROR_TRY_AGAIN"; break;
+ case ML_ERROR_UNKNOWN: szErrorVal = "ML_ERROR_UNKNOWN"; break;
+ case ML_ERROR_TIMED_OUT: szErrorVal = "ML_ERROR_TIMED_OUT"; break;
+ case ML_ERROR_NOT_SUPPORTED: szErrorVal = "ML_ERROR_NOT_SUPPORTED"; break;
+ case ML_ERROR_PERMISSION_DENIED: szErrorVal = "ML_ERROR_PERMISSION_DENIED"; break;
+ case ML_ERROR_OUT_OF_MEMORY: szErrorVal = "ML_ERROR_OUT_OF_MEMORY"; break;
+ }
+
+ return szErrorVal;
+}
+
+/**
+* @function GetResourceDataPath
+* @description Gets the resource data path
+* @parameter const char *pFilePath, const char *pFinalPath
+* @return bool
+*/
+bool GetResourceDataPath(const char *pFilePath, const char *pFinalPath)
+{
+ if ( NULL == pFilePath )
+ {
+ FPRINTF("[Line : %d][%s] Null Path provided; Check the input string\\n", __LINE__, API_NAMESPACE);
+ return false;
+ }
+
+ memset(pFinalPath, 0, PATH_LEN);
+
+ char* pPath = NULL;
+ pPath = app_get_resource_path();
+ if ( NULL == pPath )
+ {
+ FPRINTF("[Line : %d][%s] Unable to get resource data path; app_get_resource_path returned null value\\n", __LINE__, API_NAMESPACE);
+ return false;
+ }
+
+ snprintf(pFinalPath, PATH_LEN, "%s%s", pPath, pFilePath);
+
+ FPRINTF("[Line : %d][%s] resource data path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath);
+
+ return true;
+}
+
+/** @} */
\ No newline at end of file
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef _ITS_NNTRAINER_COMMON_H_
+#define _ITS_NNTRAINER_COMMON_H_
+
+//Add test package related includes here
+#include "tct_common.h"
+#include <system_info.h>
+#include <app_common.h>
+#include <dlog.h>
+#include <nntrainer.h>
+
+/** @addtogroup itc-%{MODULE_NAME}
+* @ingroup itc
+* @{
+*/
+
+#define API_NAMESPACE "NNTRAINER_ITC"
+#define ML_TRAIN_FEATURE "http://tizen.org/feature/machine_learning.training"
+#define LABEL_PATH "label.dat"
+#define CONF_PATH "model.ini"
+#define TESTSET_PATH "trainingSet.dat"
+#define TRAININGSET_PATH "trainingSet.dat"
+#define VALSET_PATH "trainingSet.dat"
+#define PATH_LEN 1024
+#define BATCH_SIZE 32
+#define FEATURE_SIZE 62720
+
+char* NnTrainerGetError(int nRet);
+bool GetResourceDataPath(const char *pFilePath, const char *pFinalPath);
+
+bool g_bIsMLTrainFeatureSupported;
+bool g_bNntrainerCreation;
+bool g_bIsFeatureMismatched;
+bool g_CallBackHit;
+
+#define START_TEST {\
+ FPRINTF("[Line:%d][%s] Starting test check initialize : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\
+ dlog_print(DLOG_INFO, "NativeTCT", "[Line:%d][%s] Starting test check initialize : %s", __LINE__, API_NAMESPACE, __FUNCTION__);\
+ if ( g_bIsFeatureMismatched ) {\
+ FPRINTF("[Line:%d][%s] Feature Mismatch Error\\n", __LINE__, API_NAMESPACE);\
+ dlog_print(DLOG_ERROR, "NativeTCT", "[Line:%d][%s] Feature Mismatch Error", __LINE__, API_NAMESPACE);\
+ return 1;\
+ }\
+ if ( !g_bIsMLTrainFeatureSupported) {\
+ FPRINTF("[Line : %d][%s] Feature Unsupported\\n", __LINE__, API_NAMESPACE);\
+ dlog_print(DLOG_ERROR, "NativeTCT", "[Line:%d][%s] Feature Unsupported", __LINE__, API_NAMESPACE);\
+ return 0;\
+ }\
+ if ( !g_bNntrainerCreation ) {\
+ FPRINTF("[Line:%d][%s] Precondition Failed\\n", __LINE__, API_NAMESPACE);\
+ dlog_print(DLOG_ERROR,"NativeTCT", "[Line:%d][%s] Precondition Failed", __LINE__, API_NAMESPACE);\
+ return 1;\
+ }\
+}
+
+/** @} */
+#endif //_ITS_NNTRAINER_COMMON_H_
--- /dev/null
+//
+// Copyright (c) 2020 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-nntrainer-common.h"
+
+static ml_train_dataset_h g_hMlTrainDataset;
+
+//& set: Nntrainer
+
+/** @addtogroup itc-nntrainer
+* @ingroup itc
+* @{
+*/
+
+/**
+* @function ConstantGeneratorCB
+* @description Callback function
+* @parameter[IN] float **outVec, float **outLabel, bool *last, void *user_data
+* @return NA
+*/
+static int ConstantGeneratorCB(float **outVec, float **outLabel, bool *last, void *user_data)
+{
+#if DEBUG
+ FPRINTF("[Line : %d][%s] ConstantGeneratorCB is called\\n", __LINE__, API_NAMESPACE);
+#endif
+
+ static int count = 0;
+ unsigned int i;
+ unsigned int data_size = BATCH_SIZE * FEATURE_SIZE;
+
+ for (i = 0; i < data_size; ++i) {
+ outVec[0][i] = 1;
+ }
+
+ for(i = 0; i < BATCH_SIZE; ++i) {
+ outLabel[0][i] = 1;
+ }
+
+ if (count == 5) {
+ *last = true;
+ count = 0;
+ } else {
+ *last = false;
+ count++;
+ }
+
+ g_CallBackHit = true;
+
+ return ML_ERROR_NONE;
+}
+
+/**
+ * @function ITs_nntrainer_dataset_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_nntrainer_dataset_startup(void)
+{
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+#if DEBUG
+ FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_nntrainer_dataset_startup\\n", __LINE__, API_NAMESPACE);
+#endif
+
+ g_bIsFeatureMismatched = false;
+ g_bNntrainerCreation = false;
+ g_bIsMLTrainFeatureSupported = TCTCheckSystemInfoFeatureSupported(ML_TRAIN_FEATURE, API_NAMESPACE);
+
+ char pszValSetPath[PATH_LEN];
+ char pszTrainingSetPath[PATH_LEN];
+ char pszTestSetPath[PATH_LEN];
+
+ if ( false == GetResourceDataPath(TRAININGSET_PATH, pszTrainingSetPath) )
+ {
+ FPRINTF("[Line : %d][%s] unable to get the training set path\\n", __LINE__, API_NAMESPACE);
+ }
+
+ if ( false == GetResourceDataPath(VALSET_PATH, pszValSetPath) )
+ {
+ FPRINTF("[Line : %d][%s] unable to get the val set path\\n", __LINE__, API_NAMESPACE);
+ }
+
+ if ( false == GetResourceDataPath(TESTSET_PATH, pszTestSetPath) )
+ {
+ FPRINTF("[Line : %d][%s] unable to get the test set path\\n", __LINE__, API_NAMESPACE);
+ }
+
+ int nRet = ml_train_dataset_create_with_file(&g_hMlTrainDataset, pszTrainingSetPath, pszValSetPath, pszTestSetPath);
+ if(!g_bIsMLTrainFeatureSupported)
+ {
+ if ( nRet != TIZEN_ERROR_NOT_SUPPORTED )
+ {
+ FPRINTF("[%s:%d] ml_train_dataset_create_with_file failed to return TIZEN_ERROR_NOT_SUPPORTED for unsupported feature, error returned = (%d)\\n", __FILE__, __LINE__,nRet);
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] ml_train_dataset_create_with_file failed to return TIZEN_ERROR_NOT_SUPPORTED for unsupported feature, error returned = (%d)", __FILE__, __LINE__, nRet);
+ g_bIsFeatureMismatched = true;
+ return;
+ }
+
+ FPRINTF("[%s:%d] ml_train_dataset_create_with_file is unsupported\\n", __FILE__, __LINE__);
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] ml_train_dataset_create_with_file is unsupported", __FILE__, __LINE__);
+ g_bIsFeatureMismatched = false;
+ }
+ else if ( nRet != ML_ERROR_NONE )
+ {
+ FPRINTF("[%s:%d] ml_train_dataset_create_with_file failed, error returned =(%d)\\n", __FILE__, __LINE__, nRet);
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] ml_train_dataset_create_with_file failed, error returned = (%d)", __FILE__, __LINE__, nRet);
+ g_bNntrainerCreation = false;
+ }
+ else
+ {
+ g_bNntrainerCreation = true;
+ }
+
+ return;
+}
+
+
+/**
+ * @function ITs_nntrainer_dataset_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_nntrainer_dataset_cleanup(void)
+{
+#if DEBUG
+ FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_nntrainer_dataset_cleanup\\n", __LINE__, API_NAMESPACE);
+#endif
+
+ if(g_hMlTrainDataset)
+ {
+ int nRet = ml_train_dataset_destroy(g_hMlTrainDataset);
+ PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRet, "ml_train_dataset_destroy", NnTrainerGetError(nRet));
+ }
+
+ return;
+}
+
+/** @addtogroup itc-nntrainer-testcases
+* @brief Integration testcases for module nntrainer
+* @ingroup itc-nntrainer
+* @{
+*/
+
+//& purpose: To create a dataset with files to feed to a neural network and frees the neural network dataset.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_dataset_create_file_destroy_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Creates a dataset with files to feed to a neural network and frees the neural network dataset.
+* @scenario Creates a dataset with files to feed to a neural network.
+* Frees the neural network dataset.
+* @apicovered ml_train_dataset_create_with_file, ml_train_dataset_destroy
+* @passcase If ml_train_dataset_create_with_file and ml_train_dataset_destroy are successfull
+* @failcase If ml_train_dataset_create_with_file or ml_train_dataset_destroy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_dataset_create_file_destroy_p(void)
+{
+ START_TEST;
+
+ char pszTestSetPath[PATH_LEN];
+ char pszTrainingSetPath[PATH_LEN];
+ char pszValSetPath[PATH_LEN];
+
+ if ( false == GetResourceDataPath(TESTSET_PATH, pszTestSetPath) )
+ {
+ FPRINTF("[Line : %d][%s] unable to get the test set path\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ if ( false == GetResourceDataPath(TRAININGSET_PATH, pszTrainingSetPath) )
+ {
+ FPRINTF("[Line : %d][%s] unable to get the training set path\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ if ( false == GetResourceDataPath(VALSET_PATH, pszValSetPath) )
+ {
+ FPRINTF("[Line : %d][%s] unable to get the val set path\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ ml_train_dataset_h hMlTrainDataset;
+ int nRet = ml_train_dataset_create_with_file(&hMlTrainDataset, pszTrainingSetPath, pszValSetPath, pszTestSetPath);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_dataset_create_with_file", NnTrainerGetError(nRet));
+ CHECK_HANDLE(hMlTrainDataset, "ml_train_dataset_create_with_file");
+
+ nRet = ml_train_dataset_destroy(hMlTrainDataset);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_dataset_destroy", NnTrainerGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: To create a dataset with generators to feed to a neural network and free the neural network dataset.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_dataset_create_generator_destroy_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Creates a dataset with generators to feed to a neural network and frees the neural network dataset.
+* @scenario Creates a dataset with generators to feed to a neural network.
+* Frees the neural network dataset.
+* @apicovered ml_train_dataset_create_with_generator, ml_train_dataset_destroy
+* @passcase If ml_train_dataset_create_with_generator and ml_train_dataset_destroy are successfull
+* @failcase If ml_train_dataset_create_with_generator or ml_train_dataset_destroy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_dataset_create_generator_destroy_p(void)
+{
+ START_TEST;
+
+ ml_train_dataset_h hMlTrainDataset;
+ g_CallBackHit = false;
+
+ int nRet = ml_train_dataset_create_with_generator(&hMlTrainDataset, ConstantGeneratorCB, ConstantGeneratorCB, ConstantGeneratorCB);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_dataset_create_with_generator", NnTrainerGetError(nRet));
+ CHECK_HANDLE(hMlTrainDataset, "ml_train_dataset_create_with_generator");
+
+ nRet = ml_train_dataset_destroy(hMlTrainDataset);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_dataset_destroy", NnTrainerGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: To set the neural network dataset property.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_dataset_set_property_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets the neural network dataset property.
+* @scenario Set neural network dataset property.
+* @apicovered ml_train_dataset_set_property
+* @passcase If ml_train_dataset_set_property is successfull
+* @failcase If ml_train_dataset_set_property fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_dataset_set_property_p(void)
+{
+ START_TEST;
+
+ int nRet = ml_train_dataset_set_property(g_hMlTrainDataset, "buffer_size=100", NULL);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_dataset_set_property", NnTrainerGetError(nRet));
+
+ return 0;
+}
+
+/** @} */
+/** @} */
--- /dev/null
+//
+// Copyright (c) 2020 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-nntrainer-common.h"
+
+static ml_train_layer_h g_hMlTrainLayer;
+
+//& set: Nntrainer
+
+/** @addtogroup itc-nntrainer
+* @ingroup itc
+* @{
+*/
+
+/**
+ * @function ITs_nntrainer_layer_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_nntrainer_layer_startup(void)
+{
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+#if DEBUG
+ FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_nntrainer_layer_startup\\n", __LINE__, API_NAMESPACE);
+#endif
+
+ g_bIsFeatureMismatched = false;
+ g_bNntrainerCreation = false;
+ g_bIsMLTrainFeatureSupported = TCTCheckSystemInfoFeatureSupported(ML_TRAIN_FEATURE, API_NAMESPACE);
+
+ int nRet = ml_train_layer_create(&g_hMlTrainLayer, ML_TRAIN_LAYER_TYPE_INPUT);
+ if(!g_bIsMLTrainFeatureSupported)
+ {
+ if ( nRet != TIZEN_ERROR_NOT_SUPPORTED )
+ {
+ FPRINTF("[%s:%d] ml_train_layer_create failed to return TIZEN_ERROR_NOT_SUPPORTED for unsupported feature, error returned = (%d)\\n", __FILE__, __LINE__,nRet);
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] ml_train_layer_create failed to return TIZEN_ERROR_NOT_SUPPORTED for unsupported feature, error returned = (%d)", __FILE__, __LINE__, nRet);
+ g_bIsFeatureMismatched = true;
+ return;
+ }
+
+ FPRINTF("[%s:%d] ml_train_layer_create is unsupported\\n", __FILE__, __LINE__);
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] ml_train_layer_create is unsupported", __FILE__, __LINE__);
+ g_bIsFeatureMismatched = false;
+ }
+ else if ( nRet != ML_ERROR_NONE )
+ {
+ FPRINTF("[%s:%d] ml_train_layer_create failed, error returned =(%d)\\n", __FILE__, __LINE__, nRet);
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] ml_train_layer_create failed, error returned = (%d)", __FILE__, __LINE__, nRet);
+ g_bNntrainerCreation = false;
+ }
+ else
+ {
+ g_bNntrainerCreation = true;
+ }
+
+ return;
+}
+
+
+/**
+ * @function ITs_nntrainer_layer_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_nntrainer_layer_cleanup(void)
+{
+#if DEBUG
+ FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_nntrainer_layer_cleanup\\n", __LINE__, API_NAMESPACE);
+#endif
+
+ if(g_hMlTrainLayer)
+ {
+ int nRet = ml_train_layer_destroy(g_hMlTrainLayer);
+ PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRet, "ml_train_layer_destroy", NnTrainerGetError(nRet));
+ }
+
+ return;
+}
+
+/** @addtogroup itc-nntrainer-testcases
+* @brief Integration testcases for module nntrainer
+* @ingroup itc-nntrainer
+* @{
+*/
+
+//& purpose: To create and free a neural network layer.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_layer_create_destroy_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Creates and frees a neural network layer.
+* Destroys neural network layer.
+* @scenario Create neural network layer.
+* @apicovered ml_train_layer_create, ml_train_layer_destroy
+* @passcase If ml_train_layer_create and ml_train_layer_destroy are successfull
+* @failcase If ml_train_layer_create or ml_train_layer_destroy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_layer_create_destroy_p(void)
+{
+ START_TEST;
+
+ ml_train_layer_type_e eMlTrainLayerType[] = {
+ ML_TRAIN_LAYER_TYPE_INPUT,
+ ML_TRAIN_LAYER_TYPE_FC
+ };
+
+ int nEnumSize = sizeof(eMlTrainLayerType) / sizeof(eMlTrainLayerType[0]);
+ ml_train_layer_h hMlTrainLayer = NULL;
+ int nRet = -1;
+
+ for (int nEnumCounter = 0; nEnumCounter < nEnumSize; nEnumCounter++)
+ {
+ nRet = ml_train_layer_create(&hMlTrainLayer, eMlTrainLayerType[nEnumCounter]);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_layer_create", NnTrainerGetError(nRet));
+ CHECK_HANDLE(hMlTrainLayer, "ml_train_layer_create");
+
+ nRet = ml_train_layer_destroy(hMlTrainLayer);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_layer_destroy", NnTrainerGetError(nRet));
+ }
+
+ return 0;
+}
+
+//& purpose: To set the neural network layer Property.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_layer_set_property_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets the neural network layer Property.
+* @scenario Set neural network layer Property.
+* @apicovered ml_train_layer_set_property
+* @passcase If ml_train_layer_set_property is successfull
+* @failcase If ml_train_layer_set_property fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_layer_set_property_p(void)
+{
+ START_TEST;
+
+ int nRet = ml_train_layer_set_property(g_hMlTrainLayer , "input_shape=1:1:6270", "normalization=true", "standardization=true", NULL);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_layer_set_property", NnTrainerGetError(nRet));
+
+ return 0;
+}
+
+/** @} */
+/** @} */
--- /dev/null
+//
+// Copyright (c) 2020 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-nntrainer-common.h"
+
+static ml_train_model_h g_hMlTrainModel;
+
+//& set: Nntrainer
+
+/** @addtogroup itc-nntrainer
+* @ingroup itc
+* @{
+*/
+
+/**
+ * @function ITs_nntrainer_model_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_nntrainer_model_startup(void)
+{
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+#if DEBUG
+ FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_nntrainer_model_startup\\n", __LINE__, API_NAMESPACE);
+#endif
+
+ char *pszResPath = app_get_resource_path();
+ if (chdir(pszResPath) < 0)
+ {
+ FPRINTF("[Line : %d][%s] initiating path failed\\n", __LINE__, API_NAMESPACE);
+ }
+ FREE_MEMORY(pszResPath);
+
+ g_bIsFeatureMismatched = false;
+ g_bNntrainerCreation = false;
+ g_bIsMLTrainFeatureSupported = TCTCheckSystemInfoFeatureSupported(ML_TRAIN_FEATURE, API_NAMESPACE);
+
+ int nRet = ml_train_model_construct(&g_hMlTrainModel);
+ if(!g_bIsMLTrainFeatureSupported)
+ {
+ if ( nRet != TIZEN_ERROR_NOT_SUPPORTED )
+ {
+ FPRINTF("[%s:%d] ml_train_model_construct failed to return TIZEN_ERROR_NOT_SUPPORTED for unsupported feature, error returned = (%d)\\n", __FILE__, __LINE__,nRet);
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] ml_train_model_construct failed to return TIZEN_ERROR_NOT_SUPPORTED for unsupported feature, error returned = (%d)", __FILE__, __LINE__, nRet);
+ g_bIsFeatureMismatched = true;
+ return;
+ }
+
+ FPRINTF("[%s:%d] ml_train_model_construct is unsupported\\n", __FILE__, __LINE__);
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] ml_train_model_construct is unsupported", __FILE__, __LINE__);
+ g_bIsFeatureMismatched = false;
+ }
+ else if ( nRet != ML_ERROR_NONE )
+ {
+ FPRINTF("[%s:%d] ml_train_model_construct failed, error returned =(%d)\\n", __FILE__, __LINE__, nRet);
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] ml_train_model_construct failed, error returned = (%d)", __FILE__, __LINE__, nRet);
+ g_bNntrainerCreation = false;
+ }
+ else
+ {
+ g_bNntrainerCreation = true;
+ }
+
+ return;
+}
+
+
+/**
+ * @function ITs_nntrainer_model_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_nntrainer_model_cleanup(void)
+{
+#if DEBUG
+ FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_nntrainer_model_cleanup\\n", __LINE__, API_NAMESPACE);
+#endif
+
+ if(g_hMlTrainModel)
+ {
+
+ int nRet = ml_train_model_destroy(g_hMlTrainModel);
+ PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRet, "ml_train_model_destroy", NnTrainerGetError(nRet));
+ }
+
+ return;
+}
+
+/** @addtogroup itc-nntrainer-testcases
+* @brief Integration testcases for module nntrainer
+* @ingroup itc-nntrainer
+* @{
+*/
+
+//& purpose: To construct and destruct the neural network model.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_model_construct_destroy_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Constructs and destructs the neural network model.
+* @scenario Constructs the neural network model.
+* Destructs the neural network model.
+* @apicovered ml_train_model_construct, ml_train_model_destroy
+* @passcase If ml_train_model_construct and ml_train_model_destroy are successfull
+* @failcase If ml_train_model_construct or ml_train_model_destroy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_model_construct_destroy_p(void)
+{
+ START_TEST;
+
+ ml_train_model_h hMlTrainModel;
+ int nRet = ml_train_model_construct(&hMlTrainModel);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_model_construct", NnTrainerGetError(nRet));
+ CHECK_HANDLE(hMlTrainModel, "ml_train_model_construct");
+
+ nRet = ml_train_model_destroy(hMlTrainModel);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_model_destroy", NnTrainerGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: To construct and destruct the neural network model with the given configuration file.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_model_construct_with_conf_destroy_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Constructs and destructs the neural network model with the given configuration file.
+* @scenario Constructs the neural network model with the given configuration file.
+* Destructs the neural network model.
+* @apicovered ml_train_model_construct_with_conf, ml_train_model_destroy
+* @passcase If ml_train_model_construct_with_conf and ml_train_model_destroy are successfull
+* @failcase If ml_train_model_construct_with_conf or ml_train_model_destroy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_model_construct_with_conf_destroy_p(void)
+{
+ START_TEST;
+
+ char pszConfPath[PATH_LEN];
+ if ( false == GetResourceDataPath(CONF_PATH, pszConfPath) )
+ {
+ FPRINTF("[Line : %d][%s] unable to get the conf path\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ ml_train_model_h hMlTrainModel;
+ int nRet = ml_train_model_construct_with_conf(pszConfPath, &hMlTrainModel);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_model_construct_with_conf", NnTrainerGetError(nRet));
+ CHECK_HANDLE(hMlTrainModel, "ml_train_model_construct_with_conf");
+
+ nRet = ml_train_model_destroy(hMlTrainModel);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_model_destroy", NnTrainerGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: To add layer in neural network model.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_model_add_layer_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Adds layer in neural network model.
+* @scenario Add a layer to the model.
+* @apicovered ml_train_model_add_layer
+* @passcase If ml_train_model_add_layer is successfull
+* @failcase If ml_train_model_add_layer fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_model_add_layer_p(void)
+{
+ START_TEST;
+
+ ml_train_layer_h hMlTrainLayer;
+ int nRet = ml_train_layer_create(&hMlTrainLayer, ML_TRAIN_LAYER_TYPE_INPUT);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_layer_create", NnTrainerGetError(nRet));
+
+ nRet = ml_train_layer_set_property(hMlTrainLayer, "input_shape=1:1:62720", "normalization=true", "standardization=true", NULL);
+ PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_train_layer_set_property", NnTrainerGetError(nRet), ml_train_layer_destroy(hMlTrainLayer));
+
+ nRet = ml_train_model_add_layer(g_hMlTrainModel, hMlTrainLayer);
+ PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_train_model_add_layer", NnTrainerGetError(nRet), ml_train_layer_destroy(hMlTrainLayer));
+
+ nRet = ml_train_layer_destroy(hMlTrainLayer);
+ PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRet, "ml_train_layer_destroy", NnTrainerGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: To set the optimizer for the neural network model.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_model_set_optimizer_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets the optimizer for the neural network model.
+* @scenario Set neural network optimizer.
+* @apicovered ml_train_model_set_optimizer
+* @passcase If ml_train_model_set_optimizer is successfull
+* @failcase If ml_train_model_set_optimizer fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_model_set_optimizer_p(void)
+{
+ START_TEST;
+
+ ml_train_optimizer_h hMlTrainOptimizer;
+ int nRet = ml_train_optimizer_create(&hMlTrainOptimizer, ML_TRAIN_OPTIMIZER_TYPE_ADAM);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_optimizer_create", NnTrainerGetError(nRet));
+
+ nRet = ml_train_optimizer_set_property(hMlTrainOptimizer, "learning_rate=0.0001", "decay_rate=0.96", "decay_steps=1000", "beta1=0.002", "beta2=0.001", "epsilon=1e-7", NULL);
+ PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_train_optimizer_set_property", NnTrainerGetError(nRet), ml_train_optimizer_destroy(hMlTrainOptimizer));
+
+ nRet = ml_train_model_set_optimizer(g_hMlTrainModel, hMlTrainOptimizer);
+ PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_train_model_set_optimizer", NnTrainerGetError(nRet), ml_train_optimizer_destroy(hMlTrainOptimizer));
+
+ nRet = ml_train_optimizer_destroy(hMlTrainOptimizer);
+ PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRet, "ml_train_optimizer_destroy", NnTrainerGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: To set the dataset for the neural network model.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_model_set_dataset_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets the dataset (data provider) for the neural network model.
+* @scenario Set dataset for running the model.
+* @apicovered ml_train_model_set_dataset
+* @passcase If ml_train_model_set_dataset is successfull
+* @failcase If ml_train_model_set_dataset fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_model_set_dataset_p(void)
+{
+ START_TEST;
+
+ char pszTrainingSetPath[PATH_LEN];
+ if ( false == GetResourceDataPath(TRAININGSET_PATH, pszTrainingSetPath) )
+ {
+ FPRINTF("[Line : %d][%s] unable to get the training set path\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ ml_train_dataset_h hMlTrainDataset;
+ int nRet = ml_train_dataset_create_with_file(&hMlTrainDataset, pszTrainingSetPath, NULL, NULL);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_dataset_create_with_file", NnTrainerGetError(nRet));
+
+ nRet = ml_train_model_set_dataset(g_hMlTrainModel, hMlTrainDataset);
+ PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_train_model_set_optimizer", NnTrainerGetError(nRet), ml_train_dataset_destroy(hMlTrainDataset));
+
+ nRet = ml_train_dataset_destroy(hMlTrainDataset);
+ PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRet, "ml_train_dataset_destroy", NnTrainerGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: To get the summary of the neural network model.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_model_get_summary_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the summary of the neural network model.
+* @scenario Get summary of the neural network model.
+* @apicovered ml_train_model_get_summary
+* @passcase If ml_train_model_get_summary is successfull
+* @failcase If ml_train_model_get_summary fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_model_get_summary_p(void)
+{
+ START_TEST;
+
+ ml_train_summary_type_e eMlTrainSummaryType[] = {
+ ML_TRAIN_SUMMARY_MODEL,
+ ML_TRAIN_SUMMARY_LAYER,
+ ML_TRAIN_SUMMARY_TENSOR
+ } ;
+
+ int nEnumSize = sizeof(eMlTrainSummaryType) / sizeof(eMlTrainSummaryType[0]);
+
+ ml_train_layer_h hMlTrainLayer;
+ int nRet = ml_train_layer_create(&hMlTrainLayer, ML_TRAIN_LAYER_TYPE_INPUT);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_layer_create", NnTrainerGetError(nRet));
+
+ nRet = ml_train_layer_set_property(hMlTrainLayer, "input_shape=1:1:62720", "normalization=true", "standardization=true", NULL);
+ PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_train_layer_set_property", NnTrainerGetError(nRet), ml_train_layer_destroy(hMlTrainLayer));
+
+ nRet = ml_train_model_add_layer(g_hMlTrainModel, hMlTrainLayer);
+ PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_train_model_add_layer", NnTrainerGetError(nRet), ml_train_layer_destroy(hMlTrainLayer));
+
+ char *pszSum = NULL;
+
+ for (int nEnumCounter = 0; nEnumCounter < nEnumSize; nEnumCounter++)
+ {
+ nRet = ml_train_model_get_summary(g_hMlTrainModel, eMlTrainSummaryType[nEnumCounter], &pszSum);
+ PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_train_model_get_summary", NnTrainerGetError(nRet), ml_train_layer_destroy(hMlTrainLayer));
+
+ FREE_MEMORY(pszSum);
+ }
+
+ nRet = ml_train_layer_destroy(hMlTrainLayer);
+ PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRet, "ml_train_layer_destroy", NnTrainerGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: To compile and finalize the neural network model with the given loss.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_model_compile_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Compiles and finalizes the neural network model with the given loss.
+* @scenario Train the compiled neural network model with the passed training hyperparameters.
+* @apicovered ml_train_model_compile
+* @passcase If ml_train_model_compile is successfull
+* @failcase If ml_train_model_compile fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_model_compile_p(void)
+{
+ START_TEST;
+
+ char pszConfPath[PATH_LEN];
+ if ( false == GetResourceDataPath(CONF_PATH, pszConfPath) )
+ {
+ FPRINTF("[Line : %d][%s] unable to get the conf path\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ ml_train_model_h hMlTrainModel;
+ int nRet = ml_train_model_construct_with_conf(pszConfPath, &hMlTrainModel);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_model_construct_with_conf", NnTrainerGetError(nRet));
+ CHECK_HANDLE(hMlTrainModel, "ml_train_model_construct_with_conf");
+
+ nRet = ml_train_model_compile(hMlTrainModel, NULL);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_model_compile", NnTrainerGetError(nRet));
+
+ nRet = ml_train_model_destroy(hMlTrainModel);
+ PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRet, "ml_train_model_destroy", NnTrainerGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: To train the neural network model.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_model_run_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Trains the neural network model.
+* @scenario Trains the neural network model.
+* @apicovered ml_train_model_run
+* @passcase If ml_train_model_run is successfull
+* @failcase If ml_train_model_run fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_model_run_p(void)
+{
+ START_TEST;
+
+ char pszConfPath[PATH_LEN];
+ if ( false == GetResourceDataPath(CONF_PATH, pszConfPath) )
+ {
+ FPRINTF("[Line : %d][%s] unable to get the conf path\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ ml_train_model_h hMlTrainModel;
+ int nRet = ml_train_model_construct_with_conf(pszConfPath, &hMlTrainModel);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_model_construct_with_conf", NnTrainerGetError(nRet));
+ CHECK_HANDLE(hMlTrainModel, "ml_train_model_construct_with_conf");
+
+ nRet = ml_train_model_compile(hMlTrainModel, NULL);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_model_compile", NnTrainerGetError(nRet));
+
+ nRet = ml_train_model_run(hMlTrainModel, NULL);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_model_run", NnTrainerGetError(nRet));
+
+ nRet = ml_train_model_destroy(hMlTrainModel);
+ PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRet, "ml_train_model_destroy", NnTrainerGetError(nRet));
+
+ return 0;
+}
+
+/** @} */
+/** @} */
--- /dev/null
+//
+// Copyright (c) 2020 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-nntrainer-common.h"
+
+static ml_train_optimizer_h g_hMlTrainOptimizer;
+
+//& set: Nntrainer
+
+/** @addtogroup itc-nntrainer
+* @ingroup itc
+* @{
+*/
+
+/**
+ * @function ITs_nntrainer_optimizer_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_nntrainer_optimizer_startup(void)
+{
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+#if DEBUG
+ FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_nntrainer_optimizer_startup\\n", __LINE__, API_NAMESPACE);
+#endif
+
+ g_bIsFeatureMismatched = false;
+ g_bNntrainerCreation = false;
+ g_bIsMLTrainFeatureSupported = TCTCheckSystemInfoFeatureSupported(ML_TRAIN_FEATURE, API_NAMESPACE);
+
+ int nRet = ml_train_optimizer_create(&g_hMlTrainOptimizer, ML_TRAIN_OPTIMIZER_TYPE_SGD);
+ if(!g_bIsMLTrainFeatureSupported)
+ {
+ if ( nRet != TIZEN_ERROR_NOT_SUPPORTED )
+ {
+ FPRINTF("[%s:%d] ml_train_optimizer_create failed to return TIZEN_ERROR_NOT_SUPPORTED for unsupported feature, error returned = (%d)\\n", __FILE__, __LINE__,nRet);
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] ml_train_optimizer_create failed to return TIZEN_ERROR_NOT_SUPPORTED for unsupported feature, error returned = (%d)", __FILE__, __LINE__, nRet);
+ g_bIsFeatureMismatched = true;
+ return;
+ }
+
+ FPRINTF("[%s:%d] ml_train_optimizer_create is unsupported\\n", __FILE__, __LINE__);
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] ml_train_optimizer_create is unsupported", __FILE__, __LINE__);
+ g_bIsFeatureMismatched = false;
+ }
+ else if ( nRet != ML_ERROR_NONE )
+ {
+ FPRINTF("[%s:%d] ml_train_optimizer_create failed, error returned =(%d)\\n", __FILE__, __LINE__, nRet);
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] ml_train_optimizer_create failed, error returned = (%d)", __FILE__, __LINE__, nRet);
+ g_bNntrainerCreation = false;
+ }
+ else
+ {
+ g_bNntrainerCreation = true;
+ }
+
+ return;
+}
+
+
+/**
+ * @function ITs_nntrainer_optimizer_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_nntrainer_optimizer_cleanup(void)
+{
+#if DEBUG
+ FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_nntrainer_optimizer_cleanup\\n", __LINE__, API_NAMESPACE);
+#endif
+
+ if(g_hMlTrainOptimizer)
+ {
+ int nRet = ml_train_optimizer_destroy(g_hMlTrainOptimizer);
+ PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRet, "ml_train_optimizer_destroy", NnTrainerGetError(nRet));
+ }
+
+ return;
+}
+
+/** @addtogroup itc-nntrainer-testcases
+* @brief Integration testcases for module nntrainer
+* @ingroup itc-nntrainer
+* @{
+*/
+
+//& purpose: To create and free a neural network optimizer.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_optimizer_create_destroy_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Creates and frees a neural network optimizer.
+* Destroys neural network optimizer.
+* @scenario Create neural network optimizer.
+* @apicovered ml_train_optimizer_create, ml_train_optimizer_destroy
+* @passcase If ml_train_optimizer_create and ml_train_optimizer_destroy are successfull
+* @failcase If ml_train_optimizer_create or ml_train_optimizer_destroy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_optimizer_create_destroy_p(void)
+{
+ START_TEST;
+
+ ml_train_optimizer_type_e eMlTrainOptimizerType[] = {
+ ML_TRAIN_OPTIMIZER_TYPE_ADAM,
+ ML_TRAIN_OPTIMIZER_TYPE_SGD
+ };
+
+ int nEnumSize = sizeof(eMlTrainOptimizerType) / sizeof(eMlTrainOptimizerType[0]);
+ ml_train_optimizer_h hMlTrainOptimizer = NULL;
+ int nRet = -1;
+
+ for (int nEnumCounter = 0; nEnumCounter < nEnumSize; nEnumCounter++)
+ {
+ nRet = ml_train_optimizer_create(&hMlTrainOptimizer, eMlTrainOptimizerType[nEnumCounter]);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_optimizer_create", NnTrainerGetError(nRet));
+ CHECK_HANDLE(hMlTrainOptimizer, "ml_train_optimizer_create");
+
+ nRet = ml_train_optimizer_destroy(hMlTrainOptimizer);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_optimizer_destroy", NnTrainerGetError(nRet));
+ }
+
+ return 0;
+}
+
+//& purpose: To set the neural network optimizer property.
+//& type: auto
+/**
+* @testcase ITc_nntrainer_optimizer_set_property_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets the neural network optimizer property.
+* @scenario Set neural network optimizer property.
+* @apicovered ml_train_optimizer_set_property
+* @passcase If ml_train_optimizer_set_property is successfull
+* @failcase If ml_train_optimizer_set_property fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_nntrainer_optimizer_set_property_p(void)
+{
+ START_TEST;
+
+ int nRet = ml_train_optimizer_set_property(g_hMlTrainOptimizer, "beta1=0.002", "beta2=0.001", NULL);
+ PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_train_optimizer_set_property", NnTrainerGetError(nRet));
+
+ return 0;
+}
+
+/** @} */
+/** @} */
--- /dev/null
+airplane
+automobile
+bird
+cat
+deer
+dog
+frog
+horse
+ship
+truck
--- /dev/null
+# Model Section : Model
+[Model]
+Type = NeuralNetwork # Model Type : Regression, KNN, NeuralNetwork
+Learning_rate = 0.0001 # Learning Rate
+Decay_rate = 0.96 # for the decay_rate for the decayed learning rate
+Decay_steps = 1000 # decay step for the exponential decayed learning rate
+Epochs = 3 # Epoch
+Optimizer = adam # Optimizer : sgd (stochastic gradien decent),
+ # adam (Adamtive Moment Estimation)
+loss = cross # Cost(loss) function : mse (mean squared error)
+ # cross (cross entropy)
+batch_size = 3
+save_path = "model.bin" # model path to save / read
+beta1 = 0.9 # beta 1 for adam
+beta2 = 0.9999 # beta 2 for adam
+epsilon = 1e-7 # epsilon for adam
+
+[DataSet]
+BufferSize=3
+TrainData="trainingSet.dat"
+ValidData="trainingSet.dat"
+LabelData="label.dat"
+
+# Layer Section : Name
+[inputlayer]
+Type = input
+Input_Shape = 1:1:62720 # Input Layer Dimensions
+bias_initializer = zeros # Zero Bias
+Normalization = true
+
+[outputlayer]
+Type = fully_connected
+Unit = 10 # Output Layer Dimension ( = Weight Width )
+bias_initializer = zeros
+Activation = sigmoid # activation : sigmoid, softmax
+Weight_Regularizer = l2norm
+Weight_Regularizer_Constant = 0.005
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "tct_common.h"
+
+#ifdef MOBILE //Starts MOBILE
+#include "tct-nntrainer-native_mobile.h"
+#endif //MOBILE //End MOBILE
+
+#ifdef WEARABLE //Starts WEARABLE
+#include "tct-nntrainer-native_wearable.h"
+#endif //WEARABLE //End WEARABLE
+
+#ifdef TV //Starts TV
+#include "tct-nntrainer-native_tv.h"
+#endif //TV //End TV
+
+#ifdef TIZENIOT //Starts TIZENIOT
+#include "tct-nntrainer-native_tizeniot.h"
+#endif //TIZENIOT //End TIZENIOT
+
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <glib.h>
+#include <stdbool.h>
+#include <app.h>
+#include <dlog.h>
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <errno.h>
+
+#include <Elementary.h>
+
+typedef struct appdata {
+ Evas_Object *win;
+ Evas_Object *conform;
+ Evas_Object *label;
+} appdata_s;
+
+static bool app_create(void *data)
+{
+ return true;
+}
+
+static void app_control(app_control_h app_control, void *data)
+{
+ char* pszGetTCName = NULL;
+ int i=0, result=0, nRet=0;
+ nRet = app_control_get_extra_data(app_control, "testcase_name", &pszGetTCName);
+ if(nRet != APP_CONTROL_ERROR_NONE)
+ {
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] app_control_get_extra_data returns error = %d", __FUNCTION__, __LINE__, nRet);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to fetch test case name: app_control_get_extra_data API call fails\\n", __FILE__, __LINE__);
+ PRINT_TC_RESULT("%d",1);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, pszGetTCName);
+ for ( i = 0; tc_array[i].name; i++ )
+ {
+ if ( 0 == strncmp(pszGetTCName, tc_array[i].name, strlen(pszGetTCName)) )
+ {
+ if ( tc_array[i].startup )
+ {
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Start up", pszGetTCName);
+ tc_array[i].startup();
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Body", pszGetTCName);
+ result = tc_array[i].function();
+ dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result);
+
+ if ( tc_array[i].cleanup )
+ {
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Clean up", pszGetTCName);
+ tc_array[i].cleanup();
+ }
+
+ PRINT_TC_RESULT("%d",result);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+ }
+ }
+
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, pszGetTCName);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to execute %s : Unknown Test Case Name\\n", __FILE__, __LINE__, pszGetTCName);
+ PRINT_TC_RESULT("%d",1);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+}
+
+static void app_terminate(void *data)
+{
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is now Terminating", __FUNCTION__, __LINE__);
+}
+
+int main(int argc, char *argv[])
+{
+ int ret = 0;
+ appdata_s ad = {0,};
+
+ ui_app_lifecycle_callback_s event_callback = {0,};
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.app_control = app_control;
+
+ //setting gcda file location for coverage
+ setenv("GCOV_PREFIX","/tmp",1);
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Coverage *.gcda File location set to /tmp/home/abuild/rpmbuild/BUILD/ ", __FUNCTION__, __LINE__);
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Main Function is Invoked", __FUNCTION__, __LINE__);
+ ret = ui_app_main(argc, argv, &event_callback, &ad);
+ if (ret != APP_ERROR_NONE)
+ {
+ dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Application ui_app_main call gets failed. err = %d\\n", __FILE__, __LINE__, ret);
+ PRINT_TC_RESULT("%d",1);
+ return ret;
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__);
+ return ret;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_NNTRAINER_NATIVE_H__
+#define __TCT_NNTRAINER_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_nntrainer_layer_startup(void);
+extern void ITs_nntrainer_layer_cleanup(void);
+extern void ITs_nntrainer_optimizer_startup(void);
+extern void ITs_nntrainer_optimizer_cleanup(void);
+extern void ITs_nntrainer_dataset_startup(void);
+extern void ITs_nntrainer_dataset_cleanup(void);
+extern void ITs_nntrainer_model_startup(void);
+extern void ITs_nntrainer_model_cleanup(void);
+
+extern int ITc_nntrainer_layer_create_destroy_p(void);
+extern int ITc_nntrainer_layer_set_property_p(void);
+extern int ITc_nntrainer_optimizer_create_destroy_p(void);
+extern int ITc_nntrainer_optimizer_set_property_p(void);
+extern int ITc_nntrainer_dataset_create_file_destroy_p(void);
+extern int ITc_nntrainer_dataset_create_generator_destroy_p(void);
+extern int ITc_nntrainer_dataset_set_property_p(void);
+extern int ITc_nntrainer_model_construct_destroy_p(void);
+extern int ITc_nntrainer_model_construct_with_conf_destroy_p(void);
+extern int ITc_nntrainer_model_add_layer_p(void);
+extern int ITc_nntrainer_model_set_optimizer_p(void);
+extern int ITc_nntrainer_model_set_dataset_p(void);
+extern int ITc_nntrainer_model_get_summary_p(void);
+extern int ITc_nntrainer_model_compile_p(void);
+extern int ITc_nntrainer_model_run_p(void);
+
+testcase tc_array[] = {
+ {"ITc_nntrainer_layer_create_destroy_p", ITc_nntrainer_layer_create_destroy_p, ITs_nntrainer_layer_startup, ITs_nntrainer_layer_cleanup},
+ {"ITc_nntrainer_layer_set_property_p", ITc_nntrainer_layer_set_property_p, ITs_nntrainer_layer_startup, ITs_nntrainer_layer_cleanup},
+ {"ITc_nntrainer_optimizer_create_destroy_p", ITc_nntrainer_optimizer_create_destroy_p, ITs_nntrainer_optimizer_startup, ITs_nntrainer_optimizer_cleanup},
+ {"ITc_nntrainer_optimizer_set_property_p", ITc_nntrainer_optimizer_set_property_p, ITs_nntrainer_optimizer_startup, ITs_nntrainer_optimizer_cleanup},
+ {"ITc_nntrainer_dataset_create_file_destroy_p", ITc_nntrainer_dataset_create_file_destroy_p, ITs_nntrainer_dataset_startup, ITs_nntrainer_dataset_cleanup},
+ {"ITc_nntrainer_dataset_create_generator_destroy_p", ITc_nntrainer_dataset_create_generator_destroy_p, ITs_nntrainer_dataset_startup, ITs_nntrainer_dataset_cleanup},
+ {"ITc_nntrainer_dataset_set_property_p", ITc_nntrainer_dataset_set_property_p, ITs_nntrainer_dataset_startup, ITs_nntrainer_dataset_cleanup},
+ {"ITc_nntrainer_model_construct_destroy_p", ITc_nntrainer_model_construct_destroy_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_construct_with_conf_destroy_p", ITc_nntrainer_model_construct_with_conf_destroy_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_add_layer_p", ITc_nntrainer_model_add_layer_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_set_optimizer_p", ITc_nntrainer_model_set_optimizer_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_set_dataset_p", ITc_nntrainer_model_set_dataset_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_get_summary_p", ITc_nntrainer_model_get_summary_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_compile_p", ITc_nntrainer_model_compile_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_run_p", ITc_nntrainer_model_run_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_NNTRAINER_NATIVE_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_NNTRAINER_NATIVE_H__
+#define __TCT_NNTRAINER_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_nntrainer_layer_startup(void);
+extern void ITs_nntrainer_layer_cleanup(void);
+extern void ITs_nntrainer_optimizer_startup(void);
+extern void ITs_nntrainer_optimizer_cleanup(void);
+extern void ITs_nntrainer_dataset_startup(void);
+extern void ITs_nntrainer_dataset_cleanup(void);
+extern void ITs_nntrainer_model_startup(void);
+extern void ITs_nntrainer_model_cleanup(void);
+
+extern int ITc_nntrainer_layer_create_destroy_p(void);
+extern int ITc_nntrainer_layer_set_property_p(void);
+extern int ITc_nntrainer_optimizer_create_destroy_p(void);
+extern int ITc_nntrainer_optimizer_set_property_p(void);
+extern int ITc_nntrainer_dataset_create_file_destroy_p(void);
+extern int ITc_nntrainer_dataset_create_generator_destroy_p(void);
+extern int ITc_nntrainer_dataset_set_property_p(void);
+extern int ITc_nntrainer_model_construct_destroy_p(void);
+extern int ITc_nntrainer_model_construct_with_conf_destroy_p(void);
+extern int ITc_nntrainer_model_add_layer_p(void);
+extern int ITc_nntrainer_model_set_optimizer_p(void);
+extern int ITc_nntrainer_model_set_dataset_p(void);
+extern int ITc_nntrainer_model_get_summary_p(void);
+extern int ITc_nntrainer_model_compile_p(void);
+extern int ITc_nntrainer_model_run_p(void);
+
+testcase tc_array[] = {
+ {"ITc_nntrainer_layer_create_destroy_p", ITc_nntrainer_layer_create_destroy_p, ITs_nntrainer_layer_startup, ITs_nntrainer_layer_cleanup},
+ {"ITc_nntrainer_layer_set_property_p", ITc_nntrainer_layer_set_property_p, ITs_nntrainer_layer_startup, ITs_nntrainer_layer_cleanup},
+ {"ITc_nntrainer_optimizer_create_destroy_p", ITc_nntrainer_optimizer_create_destroy_p, ITs_nntrainer_optimizer_startup, ITs_nntrainer_optimizer_cleanup},
+ {"ITc_nntrainer_optimizer_set_property_p", ITc_nntrainer_optimizer_set_property_p, ITs_nntrainer_optimizer_startup, ITs_nntrainer_optimizer_cleanup},
+ {"ITc_nntrainer_dataset_create_file_destroy_p", ITc_nntrainer_dataset_create_file_destroy_p, ITs_nntrainer_dataset_startup, ITs_nntrainer_dataset_cleanup},
+ {"ITc_nntrainer_dataset_create_generator_destroy_p", ITc_nntrainer_dataset_create_generator_destroy_p, ITs_nntrainer_dataset_startup, ITs_nntrainer_dataset_cleanup},
+ {"ITc_nntrainer_dataset_set_property_p", ITc_nntrainer_dataset_set_property_p, ITs_nntrainer_dataset_startup, ITs_nntrainer_dataset_cleanup},
+ {"ITc_nntrainer_model_construct_destroy_p", ITc_nntrainer_model_construct_destroy_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_construct_with_conf_destroy_p", ITc_nntrainer_model_construct_with_conf_destroy_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_add_layer_p", ITc_nntrainer_model_add_layer_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_set_optimizer_p", ITc_nntrainer_model_set_optimizer_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_set_dataset_p", ITc_nntrainer_model_set_dataset_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_get_summary_p", ITc_nntrainer_model_get_summary_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_compile_p", ITc_nntrainer_model_compile_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_run_p", ITc_nntrainer_model_run_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_NNTRAINER_NATIVE_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_NNTRAINER_NATIVE_H__
+#define __TCT_NNTRAINER_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_nntrainer_layer_startup(void);
+extern void ITs_nntrainer_layer_cleanup(void);
+extern void ITs_nntrainer_optimizer_startup(void);
+extern void ITs_nntrainer_optimizer_cleanup(void);
+extern void ITs_nntrainer_dataset_startup(void);
+extern void ITs_nntrainer_dataset_cleanup(void);
+extern void ITs_nntrainer_model_startup(void);
+extern void ITs_nntrainer_model_cleanup(void);
+
+extern int ITc_nntrainer_layer_create_destroy_p(void);
+extern int ITc_nntrainer_layer_set_property_p(void);
+extern int ITc_nntrainer_optimizer_create_destroy_p(void);
+extern int ITc_nntrainer_optimizer_set_property_p(void);
+extern int ITc_nntrainer_dataset_create_file_destroy_p(void);
+extern int ITc_nntrainer_dataset_create_generator_destroy_p(void);
+extern int ITc_nntrainer_dataset_set_property_p(void);
+extern int ITc_nntrainer_model_construct_destroy_p(void);
+extern int ITc_nntrainer_model_construct_with_conf_destroy_p(void);
+extern int ITc_nntrainer_model_add_layer_p(void);
+extern int ITc_nntrainer_model_set_optimizer_p(void);
+extern int ITc_nntrainer_model_set_dataset_p(void);
+extern int ITc_nntrainer_model_get_summary_p(void);
+extern int ITc_nntrainer_model_compile_p(void);
+extern int ITc_nntrainer_model_run_p(void);
+
+testcase tc_array[] = {
+ {"ITc_nntrainer_layer_create_destroy_p", ITc_nntrainer_layer_create_destroy_p, ITs_nntrainer_layer_startup, ITs_nntrainer_layer_cleanup},
+ {"ITc_nntrainer_layer_set_property_p", ITc_nntrainer_layer_set_property_p, ITs_nntrainer_layer_startup, ITs_nntrainer_layer_cleanup},
+ {"ITc_nntrainer_optimizer_create_destroy_p", ITc_nntrainer_optimizer_create_destroy_p, ITs_nntrainer_optimizer_startup, ITs_nntrainer_optimizer_cleanup},
+ {"ITc_nntrainer_optimizer_set_property_p", ITc_nntrainer_optimizer_set_property_p, ITs_nntrainer_optimizer_startup, ITs_nntrainer_optimizer_cleanup},
+ {"ITc_nntrainer_dataset_create_file_destroy_p", ITc_nntrainer_dataset_create_file_destroy_p, ITs_nntrainer_dataset_startup, ITs_nntrainer_dataset_cleanup},
+ {"ITc_nntrainer_dataset_create_generator_destroy_p", ITc_nntrainer_dataset_create_generator_destroy_p, ITs_nntrainer_dataset_startup, ITs_nntrainer_dataset_cleanup},
+ {"ITc_nntrainer_dataset_set_property_p", ITc_nntrainer_dataset_set_property_p, ITs_nntrainer_dataset_startup, ITs_nntrainer_dataset_cleanup},
+ {"ITc_nntrainer_model_construct_destroy_p", ITc_nntrainer_model_construct_destroy_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_construct_with_conf_destroy_p", ITc_nntrainer_model_construct_with_conf_destroy_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_add_layer_p", ITc_nntrainer_model_add_layer_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_set_optimizer_p", ITc_nntrainer_model_set_optimizer_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_set_dataset_p", ITc_nntrainer_model_set_dataset_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_get_summary_p", ITc_nntrainer_model_get_summary_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_compile_p", ITc_nntrainer_model_compile_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {"ITc_nntrainer_model_run_p", ITc_nntrainer_model_run_p, ITs_nntrainer_model_startup, ITs_nntrainer_model_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_NNTRAINER_NATIVE_H__