19#include <pybind11/stl.h>
20#include <pybind11/numpy.h>
22namespace py = pybind11;
130 template <
typename T>
void set_input(uint32_t index, py::array_t<T> &buffer)
135 uint32_t input_elements =
num_elems(&tensor_info);
136 size_t length =
sizeof(T) * input_elements;
144 template <
typename T>
void set_output(uint32_t index, py::array_t<T> &buffer)
149 uint32_t output_elements =
num_elems(&tensor_info);
150 size_t length =
sizeof(T) * output_elements;
tensorinfo output_tensorinfo(uint32_t index)
void set_input(uint32_t index, py::array_t< T > &buffer)
process input array according to data type of numpy array sent by Python (int, float,...
void set_input_layout(uint32_t index, const char *layout)
void set_output_layout(uint32_t index, const char *layout)
tensorinfo input_tensorinfo(uint32_t index)
void set_input_tensorinfo(uint32_t index, const tensorinfo *tensor_info)
void set_output(uint32_t index, py::array_t< T > &buffer)
process output array according to data type of numpy array sent by Python (int, float,...
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_set_output(nnfw_session *session, uint32_t index, NNFW_TYPE type, void *buffer, size_t length)
Set output buffer.
NNFW_LAYOUT
Data format of a tensor.
NNFW_TYPE getType(const char *type="")
void ensure_status(NNFW_STATUS status)
Handle errors with NNFW_STATUS in API functions.
NNFW_LAYOUT getLayout(const char *layout="")
py::list get_dims(const tensorinfo &tensor_info)
Get nnfw_tensorinfo->dims.
uint64_t num_elems(const nnfw_tensorinfo *tensor_info)
Get the total number of elements in nnfw_tensorinfo->dims.
void set_dims(tensorinfo &tensor_info, const py::list &array)
Set nnfw_tensorinfo->dims.
const char * getStringType(NNFW_TYPE type)
NNFW_STATUS
Result values returned from a call to an API function.
#define NNFW_MAX_RANK
Maximum rank expressible with nnfw.
tensor info describes the type and shape of tensors
tensor info describes the type and shape of tensors
int32_t dims[NNFW_MAX_RANK]