24 for (uint32_t i = 0; i < ti->
rank; ++i)
31int main(
const int argc,
char **argv)
47 std::vector<float> input;
51 input.resize(input_elements);
56 std::vector<float> output;
58 uint32_t output_elements =
num_elems(&ti);
59 output.resize(output_elements);
69 std::cout <<
"nnpackage " << argv[1] <<
" runs successfully." << std::endl;
uint64_t num_elems(const nnfw_tensorinfo *ti)
Get the total number of elements in nnfw_tensorinfo->dims.
This file describes runtime API.
NNFW_STATUS nnfw_set_input(nnfw_session *session, uint32_t index, NNFW_TYPE type, const void *buffer, size_t length)
Set input buffer.
NNFW_STATUS nnfw_output_tensorinfo(nnfw_session *session, uint32_t index, nnfw_tensorinfo *tensor_info)
Get i-th output tensor info.
NNFW_STATUS nnfw_input_tensorinfo(nnfw_session *session, uint32_t index, nnfw_tensorinfo *tensor_info)
Get i-th input tensor info.
NNFW_STATUS nnfw_run(nnfw_session *session)
Run inference.
NNFW_STATUS nnfw_prepare(nnfw_session *session)
Prepare session to be ready for inference.
NNFW_STATUS nnfw_set_output(nnfw_session *session, uint32_t index, NNFW_TYPE type, void *buffer, size_t length)
Set output buffer.
NNFW_STATUS nnfw_set_op_backend(nnfw_session *session, const char *op, const char *backend)
Set the operation's backend.
NNFW_STATUS nnfw_create_session(nnfw_session **session)
Create a new session instance.
NNFW_STATUS nnfw_close_session(nnfw_session *session)
Close a session instance.
NNFW_STATUS nnfw_load_model_from_file(nnfw_session *session, const char *package_file_path)
Load model from nnpackage file or directory.
tensor info describes the type and shape of tensors
int32_t dims[NNFW_MAX_RANK]