From: 이춘석/On-Device Lab(SR)/Staff Engineer/삼성전자 Date: Mon, 12 Aug 2019 02:20:32 +0000 (+0900) Subject: API for Input/Output Tensor information (#6153) X-Git-Tag: submit/tizen/20190812.062103~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3cb5ff870ad5c428786ece61544f9ae7d7da8ccf;p=platform%2Fcore%2Fml%2Fnnfw.git 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 --- 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