Add common api header for nntrainer.
This common header includes declarations common to all the APIs
and is used in nntrainer as well.
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
ifndef NNTRAINER_ROOT
NNTRAINER_ROOT := $(LOCAL_PATH)/../../../libs/arm64-v8a
NNTRAINER_INCLUDES := $(LOCAL_PATH)/../../../nntrainer/include \
- $(LOCAL_PATH)/../../../api/capi/include \
+ $(LOCAL_PATH)/../../../api \
$(LOCAL_PATH)/../../../api/capi/include/platform
endif
ifndef NNTRAINER_ROOT
NNTRAINER_ROOT := $(LOCAL_PATH)/../../../libs/arm64-v8a
NNTRAINER_INCLUDES := $(LOCAL_PATH)/../../../nntrainer/include \
- $(LOCAL_PATH)/../../../api/capi/include \
+ $(LOCAL_PATH)/../../../api \
$(LOCAL_PATH)/../../../api/capi/include/platform
endif
#include <stddef.h>
#include <ml-api-common.h>
+#include <nntrainer-api-common.h>
#ifdef __cplusplus
extern "C" {
capi_inc = []
capi_inc += include_directories('include')
+capi_inc += include_directories('..')
# pc file is not present for 'ml-api-common' yet
if cxx.has_header('nnstreamer/ml-api-common.h', required: false)
capi_headers = []
capi_headers += join_paths(meson.current_source_dir(), 'include', 'nntrainer.h')
+capi_headers += join_paths(meson.current_source_dir(), '..', 'nntrainer-api-common.h')
capi_deps = [
nntrainer_dep
--- /dev/null
+// SPDX-License-Identifier: Apache-2.0-only
+/**
+ * Copyright (C) 2020 Parichay Kapoor <pk.kapoor@samsung.com>
+ *
+ * @file nntrainer-api-common.h
+ * @date 02 April 2020
+ * @brief NNTrainer Common-API Header.
+ * @see https://github.com/nnstreamer/nntrainer
+ * @author Parichay Kapoor <pk.kapoor@samsung.com>
+ * @bug No known bugs except for NYI items
+ */
+
+/**
+ * @brief Dataset generator callback function for train/valid/test data.
+ * @details The Containers passed will already be allocated with sufficient
+ * space to contain the data by the caller. This function should return a batch
+ * of input and label of data in the passed containers. The callback should fill
+ * the data row-wise in the containers obliging to the input shape set for the
+ * model. The order of the inputs in case of multiple input layers will be
+ * determined based on the sequence of addition of the input layers to the
+ * model.
+ * @note This function can be called multiple times in parallel.
+ * @param[out] input Container to hold all the input data.
+ * @param[out] label Container to hold corresponding label data.
+ * @param[out] last Container to notify if data is finished. Set true if no more
+ * data to provide, else set false.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_INVALID_PARAMETER Invalid Parameter.
+ */
+typedef int (*ml_train_datagen_cb)(float **input, float **label, bool *last);
$(NNTRAINER_ROOT)/nntrainer/src/flatten_layer.cpp
NNTRAINER_INCLUDES := $(NNTRAINER_ROOT)/nntrainer/include \
- $(NNTRAINER_ROOT)/api/capi/include \
+ $(NNTRAINER_ROOT)/api \
$(NNTRAINER_ROOT)/api/capi/include/platform
INIPARSER_SRCS := $(INIPARSER_ROOT)/src/iniparser.c \
#include <functional>
#include <iostream>
#include <memory>
-#include <nntrainer.h>
+#include <nntrainer-api-common.h>
#include <thread>
#include <vector>
nntrainer_inc = [
include_directories('./include'),
- include_directories('../api/capi/include')
+ include_directories('../api')
]
# pc file is not present for 'ml-api-common' yet
'include/pooling2d_layer.h',
'include/tensor.h',
'include/tensor_dim.h',
- 'include/util_func.h'
+ 'include/util_func.h',
+ '../api/nntrainer-api-common.h'
]
# Build libraries
%{_includedir}/nntrainer/optimizer.h
%{_includedir}/nntrainer/util_func.h
%{_includedir}/nntrainer/parse_util.h
+%{_includedir}/nntrainer/nntrainer-api-common.h
%{_libdir}/pkgconfig/nntrainer.pc
%files devel-static
%files -n capi-nntrainer-devel
%{_includedir}/nntrainer/nntrainer.h
+%{_includedir}/nntrainer/nntrainer-api-common.h
%{_libdir}/pkgconfig/capi-nntrainer.pc
%files -n capi-nntrainer-devel-static