17#ifndef __API_NNFW_SESSION_H__
18#define __API_NNFW_SESSION_H__
88 enum class AutoCompilationState
91 QUANTIZED_MODEL_LOADED,
200 uint32_t getInputSize();
201 uint32_t getOutputSize();
202 NNFW_STATUS loadModelFile(
const std::string &model_file_path,
const std::string &model_type);
204 bool isStateInitialized();
205 bool isStateModelLoaded();
206 bool isStatePrepared();
207 bool isStateRunning();
208 bool isStateFinishedRun();
209 bool isStatePreparedOrFinishedRun();
210 bool isStatePreparedTraining();
211 bool isStateFinishedTraining();
212 bool isStatePreparedOrFinishedTraining();
215 State _state{State::INITIALIZED};
216 std::unique_ptr<onert::ir::NNPkg> _nnpkg;
217 std::unique_ptr<onert::compiler::CompilerOptions> _coptions;
218 std::unique_ptr<onert::compiler::CompilerArtifact> _compiler_artifact;
219 std::unique_ptr<onert::exec::Execution> _execution;
220 std::shared_ptr<onert::api::CustomKernelRegistry> _kernel_registry;
221 std::vector<std::thread> _threads;
222 std::unique_ptr<onert::ir::train::TrainingInfo> _train_info;
223 std::unique_ptr<onert::odc::QuantizeManager> _quant_manager;
224 std::unique_ptr<onert::odc::CodegenManager> _codegen_manager;
225 AutoCompilationState _autoCompilationState = AutoCompilationState::INITIAL_STATE;
235 std::filesystem::path _model_path;
236 std::unordered_map<onert::ir::SubgraphIndex, std::string> _signature_map;
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 set_input_type(uint32_t index, NNFW_TYPE type)
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 set_signature_for_tensorinfo(const char *signature)
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_output_type(uint32_t index, NNFW_TYPE type)
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 get_output(uint32_t index, nnfw_tensorinfo *out_info, const void **out_buffer)
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 set_signature_run(const char *signature)
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.