Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[onert] Relocate API functions #14416

Merged
merged 1 commit into from
Dec 9, 2024
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
23 changes: 4 additions & 19 deletions runtime/onert/api/nnfw/src/nnfw_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
* limitations under the License.
*/

#include "nnfw_api_internal.h"
#include "nnfw.h"
#include "nnfw_experimental.h"
#include "nnfw_version.h"

#include "nnfw_session.h"

// Double-check enum value changes

#define STATIC_ASSERT_ENUM_CHECK(ENUM, VAL) static_assert((ENUM) == (VAL), #ENUM " has changed")
Expand Down Expand Up @@ -334,18 +337,6 @@ NNFW_STATUS nnfw_query_info_u32(nnfw_session *session, NNFW_INFO_ID id, uint32_t
return NNFW_STATUS_ERROR;
}

NNFW_STATUS nnfw_load_circle_from_buffer(nnfw_session *session, uint8_t *buffer, size_t size)
{
NNFW_RETURN_ERROR_IF_NULL(session);
return session->load_circle_from_buffer(buffer, size);
}

NNFW_STATUS nnfw_load_model_from_modelfile(nnfw_session *session, const char *file_path)
{
NNFW_RETURN_ERROR_IF_NULL(session);
return session->load_model_from_modelfile(file_path);
}

NNFW_STATUS nnfw_input_tensorindex(nnfw_session *session, const char *tensorname, uint32_t *index)
{
NNFW_RETURN_ERROR_IF_NULL(session);
Expand Down Expand Up @@ -458,12 +449,6 @@ NNFW_STATUS nnfw_train_export_circle(nnfw_session *session, const char *path)
return session->train_export_circle(path);
}

NNFW_STATUS nnfw_train_export_circleplus(nnfw_session *session, const char *path)
{
NNFW_RETURN_ERROR_IF_NULL(session);
return session->train_export_circleplus(path);
}

NNFW_STATUS nnfw_train_import_checkpoint(nnfw_session *session, const char *path)
{
NNFW_RETURN_ERROR_IF_NULL(session);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

#include "nnfw_api_internal.h"
#include "nnfw_internal.h"

#include "nnfw_session.h"

#include <util/ConfigSource.h>

Expand All @@ -36,3 +38,21 @@ NNFW_STATUS nnfw_get_config(nnfw_session *session, const char *key, char *value,
NNFW_RETURN_ERROR_IF_NULL(session);
return session->get_config(key, value, value_size);
}

NNFW_STATUS nnfw_load_circle_from_buffer(nnfw_session *session, uint8_t *buffer, size_t size)
{
NNFW_RETURN_ERROR_IF_NULL(session);
return session->load_circle_from_buffer(buffer, size);
}

NNFW_STATUS nnfw_load_model_from_modelfile(nnfw_session *session, const char *file_path)
{
NNFW_RETURN_ERROR_IF_NULL(session);
return session->load_model_from_modelfile(file_path);
}

NNFW_STATUS nnfw_train_export_circleplus(nnfw_session *session, const char *path)
{
NNFW_RETURN_ERROR_IF_NULL(session);
return session->train_export_circleplus(path);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "nnfw_api_internal.h"
#include "nnfw_session.h"

#include "compiler/CompilerFactory.h"
#include "exporter/CircleExporter.h"
Expand Down
Copy link
Contributor

@chunseoklee chunseoklee Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__API_NNFW_API_INTERNAL_H__ -> __API_NNFW_SESSION_H__ ?

Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
* limitations under the License.
*/

#ifndef __API_NNFW_API_INTERNAL_H__
#define __API_NNFW_API_INTERNAL_H__
#ifndef __API_NNFW_SESSION_H__
#define __API_NNFW_SESSION_H__

#include "nnfw.h"
#include "nnfw_experimental.h"

#include "CustomKernelRegistry.h"
#include "compiler/CompilerOptions.h"
Expand Down Expand Up @@ -231,4 +230,4 @@ struct nnfw_session
std::filesystem::path _model_path;
};

#endif // __API_NNFW_API_INTERNAL_H__
#endif // __API_NNFW_SESSION_H__