Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions runtime/onert/api/nnfw/include/nnfw.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,19 @@ NNFW_STATUS nnfw_create_session(nnfw_session **session);
*/
NNFW_STATUS nnfw_close_session(nnfw_session *session);

/**
* @brief Get the last error message
*
* This function retrieves the last error message occurred in the session.
*
* @param[in] session The session to get the last error message from
* @param[out] buffer Buffer to store the last error message string
* @param[in] length The size of the buffer
* @return @c NNFW_STATUS_NO_ERROR if successful, otherwise appropriate
* error code and the content of buffer is not changed.
*/
NNFW_STATUS nnfw_get_last_error_message(nnfw_session *session, char *buffer, size_t length);

/**
* @brief Load model from path to model or nnpackage
*
Expand Down
31 changes: 21 additions & 10 deletions runtime/onert/api/nnfw/src/APIImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ NNFW_STATUS nnfw_close_session(nnfw_session *session)
return NNFW_STATUS_NO_ERROR;
}

NNFW_STATUS nnfw_get_last_error_message(nnfw_session *session, char *buffer, size_t length)
{
NNFW_RETURN_ERROR_IF_NULL(session);
return reinterpret_cast<Session *>(session)->get_last_error_message(buffer, length);
}

NNFW_STATUS nnfw_load_model_from_file(nnfw_session *session, const char *path)
{
NNFW_RETURN_ERROR_IF_NULL(session);
Expand Down Expand Up @@ -170,9 +176,10 @@ NNFW_STATUS nnfw_register_custom_op_info(nnfw_session *session, const char *id,
return reinterpret_cast<Session *>(session)->register_custom_operation(id, info->eval_function);
}

NNFW_STATUS nnfw_apply_tensorinfo(nnfw_session *, uint32_t, nnfw_tensorinfo)
NNFW_STATUS nnfw_apply_tensorinfo(nnfw_session *session, uint32_t, nnfw_tensorinfo)
{
return Session::deprecated("nnfw_apply_tensorinfo: Deprecated");
NNFW_RETURN_ERROR_IF_NULL(session);
return reinterpret_cast<Session *>(session)->deprecated("nnfw_apply_tensorinfo: Deprecated");
}

NNFW_STATUS nnfw_set_input_tensorinfo(nnfw_session *session, uint32_t index,
Expand All @@ -188,9 +195,10 @@ NNFW_STATUS nnfw_set_available_backends(nnfw_session *session, const char *backe
return reinterpret_cast<Session *>(session)->set_available_backends(backends);
}

NNFW_STATUS nnfw_set_op_backend(nnfw_session *, const char *, const char *)
NNFW_STATUS nnfw_set_op_backend(nnfw_session *session, const char *, const char *)
{
return Session::deprecated("nnfw_set_op_backend: Deprecated");
NNFW_RETURN_ERROR_IF_NULL(session);
return reinterpret_cast<Session *>(session)->deprecated("nnfw_set_op_backend: Deprecated");
}

NNFW_STATUS nnfw_query_info_u32(nnfw_session *session, NNFW_INFO_ID id, uint32_t *val)
Expand Down Expand Up @@ -230,19 +238,22 @@ NNFW_STATUS nnfw_set_backends_per_operation(nnfw_session *session, const char *b
return reinterpret_cast<Session *>(session)->set_backends_per_operation(backend_settings);
}

NNFW_STATUS nnfw_prepare_pipeline(nnfw_session *, const char *)
NNFW_STATUS nnfw_prepare_pipeline(nnfw_session *session, const char *)
{
return Session::deprecated("nnfw_prepare_pipeline: Deprecated");
NNFW_RETURN_ERROR_IF_NULL(session);
return reinterpret_cast<Session *>(session)->deprecated("nnfw_prepare_pipeline: Deprecated");
}

NNFW_STATUS nnfw_push_pipeline_input(nnfw_session *, void *, void *)
NNFW_STATUS nnfw_push_pipeline_input(nnfw_session *session, void *, void *)
{
return Session::deprecated("nnfw_push_pipeline_input: Deprecated");
NNFW_RETURN_ERROR_IF_NULL(session);
return reinterpret_cast<Session *>(session)->deprecated("nnfw_push_pipeline_input: Deprecated");
}

NNFW_STATUS nnfw_pop_pipeline_output(nnfw_session *, void *)
NNFW_STATUS nnfw_pop_pipeline_output(nnfw_session *session, void *)
{
return Session::deprecated("nnfw_pop_pipeline_output: Deprecated");
NNFW_RETURN_ERROR_IF_NULL(session);
return reinterpret_cast<Session *>(session)->deprecated("nnfw_pop_pipeline_output: Deprecated");
}

NNFW_STATUS nnfw_set_workspace(nnfw_session *session, const char *dir)
Expand Down
Loading