From 3cb5ff870ad5c428786ece61544f9ae7d7da8ccf Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=EC=B6=98=EC=84=9D/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 12 Aug 2019 11:20:32 +0900 Subject: [PATCH] API for Input/Output Tensor information (#6153) * API for Input/Output Tensor information - Add nnfw_tensor_info - input/output size getter Signed-off-by: Chunseok Lee * Fix typo, tensor_info -> tensorinfo --- runtimes/include/nnfw.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/runtimes/include/nnfw.h b/runtimes/include/nnfw.h index d3a9ba7..2a1b22d 100644 --- a/runtimes/include/nnfw.h +++ b/runtimes/include/nnfw.h @@ -46,6 +46,15 @@ typedef enum { NNFW_STATUS_ERROR = 1, } NNFW_STATUS; +/** + * tensor_info + */ +struct nnfw_tensorinfo { + NNFW_TYPE dtype; + int rank; + int dims[6]; // MAX rank is 6 +} + /* * Create a new session instance * @@ -119,6 +128,48 @@ NNFW_STATUS nnfw_set_input(nnfw_session *session, int index, NNFW_TYPE type, con NNFW_STATUS nnfw_set_output(nnfw_session *session, int index, NNFW_TYPE type, void *buffer, size_t length); +/* + * Get the number of inputs + * + * @param[in] session session from input information is to be extracted + * @param[out] number variable which the number of inputs is put into + * + * @return NNFW_STATUS_NO_ERROR if successful + */ +NNFW_STATUS nnfw_input_size(nnfw_session *session, int index, int *number); + +/* + * Get the number of outputs + * + * @param[in] session session from output information is to be extracted + * @param[out] number variable which the number of outputs is put into + * + * @return NNFW_STATUS_NO_ERROR if successful + */ +NNFW_STATUS nnfw_output_size(nnfw_session *session, int *number); + +/* + * Get i-th input tensor info + * + * @param[in] session session from input information is to be extracted + * @param[in] index index of input + * @param[out] tensor_info nnfw_tensor_info + * + * @return NNFW_STATUS_NO_ERROR if successful + */ +NNFW_STATUS nnfw_input_tensorinfo(nnfw_session *session, int index, nnfw_tensorinfo *tensor_info); + +/* + * Get i-th output tensor info + * + * @param[in] session session from output information is to be extracted + * @param[in] index index of output + * @param[out] tensor_info nnfw_tensor_info + * + * @return NNFW_STATUS_NO_ERROR if successful + */ +NNFW_STATUS nnfw_output_tensorinfo(nnfw_session *session, int index, nnfw_tensorinfo *tensor_info); + #ifdef __cplusplus } #endif -- 2.7.4