tvm
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Typedefs | Functions
graph_executor.h File Reference

Tiny AoT executor. More...

#include <dlpack/dlpack.h>
#include <tvm/runtime/c_runtime_api.h>
#include <tvm/runtime/crt/packed_func.h>
Include dependency graph for graph_executor.h:

Go to the source code of this file.

Classes

struct  TVMOpParam
 operator attributes about tvm op More...
 
struct  TVMGraphExecutorGraphAttr
 

Typedefs

typedef struct TVMOpParam TVMOpParam
 operator attributes about tvm op More...
 
typedef struct TVMGraphExecutorGraphAttr TVMGraphExecutorGraphAttr
 
typedef struct TVMGraphExecutor TVMGraphExecutor
 

Functions

int TVMGraphExecutor_Create (const char *sym_json, TVMModuleHandle module_handle, const DLDevice *devices, TVMGraphExecutor **executor)
 Allocate a new GraphExecutor with TVMPlatformMemoryAllocate and initialize it. More...
 
int TVMGraphExecutor_GetInputIndex (TVMGraphExecutor *executor, const char *name)
 
int TVMGraphExecutor_GetNumInputs ()
 get number of input tensors allocated. More...
 
void TVMGraphExecutor_SetInput (TVMGraphExecutor *executor, const char *name, DLTensor *data_in)
 set input to the graph based on name. More...
 
int TVMGraphExecutor_GetNumOutputs ()
 get number of output tensors allocated. More...
 
int TVMGraphExecutor_GetOutput (TVMGraphExecutor *executor, const int32_t index, DLTensor *out)
 Return NDArray for given output index. More...
 
int TVMGraphExecutor_LoadParams (TVMGraphExecutor *executor, const char *param_blob, const uint32_t param_size)
 Load parameters from parameter blob. More...
 
void TVMGraphExecutor_Run (TVMGraphExecutor *executor)
 Execute the graph. More...
 
int TVMGraphExecutor_Release (TVMGraphExecutor **executor)
 Release memory associated with the graph executor. More...
 

Detailed Description

Tiny AoT executor.

Tiny graph executor that can run graph containing only tvm PackedFunc.

Typedef Documentation

◆ TVMGraphExecutor

◆ TVMGraphExecutorGraphAttr

◆ TVMOpParam

typedef struct TVMOpParam TVMOpParam

operator attributes about tvm op

Function Documentation

◆ TVMGraphExecutor_Create()

int TVMGraphExecutor_Create ( const char *  sym_json,
TVMModuleHandle  module_handle,
const DLDevice *  devices,
TVMGraphExecutor **  executor 
)

Allocate a new GraphExecutor with TVMPlatformMemoryAllocate and initialize it.

Parameters
sym_jsonJSON-encoded graph.
module_handleTVM Module that exposes the functions to call.
devicesruntime execution device.
executorPointer which receives a pointer to the newly-created instance.
Returns
0 if successful.

◆ TVMGraphExecutor_GetInputIndex()

int TVMGraphExecutor_GetInputIndex ( TVMGraphExecutor executor,
const char *  name 
)

◆ TVMGraphExecutor_GetNumInputs()

int TVMGraphExecutor_GetNumInputs ( )

get number of input tensors allocated.

Returns
integer number of tensors available to use.

◆ TVMGraphExecutor_GetNumOutputs()

int TVMGraphExecutor_GetNumOutputs ( )

get number of output tensors allocated.

Returns
integer number of output tensors allocated.

◆ TVMGraphExecutor_GetOutput()

int TVMGraphExecutor_GetOutput ( TVMGraphExecutor executor,
const int32_t  index,
DLTensor *  out 
)

Return NDArray for given output index.

Parameters
executorThe graph executor.
indexThe output index.
outThe DLTensor corresponding to given output node index.
Returns
The result of this function execution.

◆ TVMGraphExecutor_LoadParams()

int TVMGraphExecutor_LoadParams ( TVMGraphExecutor executor,
const char *  param_blob,
const uint32_t  param_size 
)

Load parameters from parameter blob.

Parameters
executorThe graph executor.
param_blobA binary blob of parameter.
param_sizeThe parameter size.
Returns
The result of this function execution.

◆ TVMGraphExecutor_Release()

int TVMGraphExecutor_Release ( TVMGraphExecutor **  executor)

Release memory associated with the graph executor.

Parameters
executorPointer to graph executor.
Returns
0 if successful

◆ TVMGraphExecutor_Run()

void TVMGraphExecutor_Run ( TVMGraphExecutor executor)

Execute the graph.

Parameters
executorThe graph executor.

◆ TVMGraphExecutor_SetInput()

void TVMGraphExecutor_SetInput ( TVMGraphExecutor executor,
const char *  name,
DLTensor *  data_in 
)

set input to the graph based on name.

Parameters
executorThe graph executor.
nameThe name of the input.
data_inThe input data.