17#ifndef __API_NNFW_SESSION_H__
18#define __API_NNFW_SESSION_H__
88 enum class AutoCompilationState
91 QUANTIZED_MODEL_LOADED,
194 uint32_t getInputSize();
195 uint32_t getOutputSize();
196 NNFW_STATUS loadModelFile(
const std::string &model_file_path,
const std::string &model_type);
198 bool isStateInitialized();
199 bool isStateModelLoaded();
200 bool isStatePrepared();
201 bool isStateRunning();
202 bool isStateFinishedRun();
203 bool isStatePreparedOrFinishedRun();
204 bool isStatePreparedTraining();
205 bool isStateFinishedTraining();
206 bool isStatePreparedOrFinishedTraining();
209 State _state{State::INITIALIZED};
210 std::shared_ptr<onert::ir::NNPkg> _nnpkg;
211 std::unique_ptr<onert::compiler::CompilerOptions> _coptions;
212 std::shared_ptr<onert::compiler::CompilerArtifact> _compiler_artifact;
213 std::unique_ptr<onert::exec::Execution> _execution;
214 std::shared_ptr<onert::api::CustomKernelRegistry> _kernel_registry;
215 std::vector<std::thread> _threads;
216 std::unique_ptr<onert::ir::train::TrainingInfo> _train_info;
217 std::unique_ptr<onert::odc::QuantizeManager> _quant_manager;
218 std::unique_ptr<onert::odc::CodegenManager> _codegen_manager;
219 AutoCompilationState _autoCompilationState = AutoCompilationState::INITIAL_STATE;
229 std::filesystem::path _model_path;
This file defines execution.
This file contains ICompiler class to define and run compilation phase.
volatile const char info[]
This file describes runtime API.
NNFW_LAYOUT
Data format of a tensor.
void(* nnfw_custom_eval)(nnfw_custom_kernel_params *params, char *userdata, size_t userdata_size)
NNFW_CODEGEN_PREF
Preference for target-dependent code generation.
NNFW_QUANTIZE_TYPE
Convert between training mode and inference mode.
NNFW_RUN_CONFIG
Configuration key for execution.
NNFW_PREPARE_CONFIG
Configuration key for prepare (compile and schedule)
NNFW_STATUS
Result values returned from a call to an API function.
NNFW_STATUS train_prepare()
NNFW_STATUS train_set_output(uint32_t index, NNFW_TYPE type, void *buffer, size_t length)
NNFW_STATUS train_get_traininfo(nnfw_train_info *info)
NNFW_STATUS set_config(const char *key, const char *value)
NNFW_STATUS train_set_expected(uint32_t index, void *expected)
NNFW_STATUS delete_odc_minmax_file()
NNFW_STATUS set_odc_param_minmax_records_count(int minmax_records_count)
NNFW_STATUS train_run(bool update_weights)
NNFW_STATUS input_tensorinfo(uint32_t index, nnfw_tensorinfo *ti)
NNFW_STATUS output_tensorinfo(uint32_t index, nnfw_tensorinfo *ti)
NNFW_STATUS set_input_tensorinfo(uint32_t index, const nnfw_tensorinfo *ti)
NNFW_STATUS input_tensorindex(const char *tensorname, uint32_t *index)
NNFW_STATUS train_export_checkpoint(const char *path)
NNFW_STATUS set_output(uint32_t index, NNFW_TYPE type, void *buffer, size_t length)
NNFW_STATUS train_import_checkpoint(const char *path)
NNFW_STATUS set_workspace(const char *dir)
static NNFW_STATUS deprecated(const char *msg)
NNFW_STATUS train_expected_tensorinfo(uint32_t index, nnfw_tensorinfo *ti)
NNFW_STATUS reset_prepare_config()
NNFW_STATUS set_codegen_model_path(const char *path)
NNFW_STATUS train_set_input(uint32_t index, void *input)
NNFW_STATUS reset_execute_config()
NNFW_STATUS set_input(uint32_t index, NNFW_TYPE type, const void *buffer, size_t length)
NNFW_STATUS output_size(uint32_t *number)
NNFW_STATUS train_get_loss(uint32_t index, float *loss)
NNFW_STATUS load_model_from_path(const char *path)
NNFW_STATUS set_backends_per_operation(const char *backend_settings)
Set backends with string-encoded mapping from operation index to backend type (cpu,...
NNFW_STATUS set_quantization_type(NNFW_QUANTIZE_TYPE qtype)
NNFW_STATUS input_size(uint32_t *number)
NNFW_STATUS set_prepare_config(const NNFW_PREPARE_CONFIG key, const char *value)
NNFW_STATUS set_available_backends(const char *backends)
NNFW_STATUS get_config(const char *key, char *value, size_t value_size)
NNFW_STATUS codegen(const char *target, NNFW_CODEGEN_PREF pref)
NNFW_STATUS set_execute_config(const NNFW_RUN_CONFIG key, const char *value)
NNFW_STATUS run_with_auto_compilation(const char *target, NNFW_CODEGEN_PREF pref)
NNFW_STATUS set_output_layout(uint32_t index, NNFW_LAYOUT layout)
NNFW_STATUS train_input_tensorinfo(uint32_t index, nnfw_tensorinfo *ti)
NNFW_STATUS register_custom_operation(const std::string &id, nnfw_custom_eval eval_func)
NNFW_STATUS train_export_circle(const char *path)
NNFW_STATUS output_tensorindex(const char *tensorname, uint32_t *index)
NNFW_STATUS set_quantized_model_path(const char *path)
NNFW_STATUS load_circle_from_buffer(uint8_t *buffer, size_t size)
NNFW_STATUS train_export_circleplus(const char *path)
NNFW_STATUS set_input_layout(uint32_t index, NNFW_LAYOUT layout)
static NNFW_STATUS create(nnfw_session **session)
Factory method. It creates and initialize nnfw_session.
NNFW_STATUS train_set_traininfo(const nnfw_train_info *info)
tensor info describes the type and shape of tensors
Training information to prepare training.