Convenience API

NNC provides convenience APIs for its usage. You can use it by simply #include <nnc/ccv_nnc_easy.h>. But being convenience API, it is optimized for shorthand coding, and may collide the naming space with others.

const int ccv_nnc_no_ofs[CCV_NNC_MAX_DIM_ALLOC]

Offsets all zero.

const ccv_nnc_hint_t ccv_nnc_no_hint

No hint available.

const ccv_nnc_cmd_param_t ccv_nnc_cmd_auto

Derive the command parameters automatically if possible.

const ccv_nnc_tensor_param_t ccv_nnc_tensor_auto

Derive the tensor parameters automatically if possible.

TENSOR_LIST(...)

Pass a list of tensors to NNC functions that accepts (tensor array, tensor array size). This method effectively gives two parameters as one.

TENSOR_PARAM_LIST(...)

Pass a list of tensor parameters to NNC functions that accepts (parameter array, parameter array size). This method effectively gives two parameters as one.

NO_TENSOR_SYMBOL

This represents a tensor symbol that is empty (tensor = nil)

NO_GRAPH_EXEC_SYMBOL

This represents a graph exec symbol that is empty (exec = nil)

TENSOR_SYMBOL_LIST(...)

Pass a list of tensor symbols to NNC functions that accepts (tensor symbol array, tensor symbol array size). This method effectively gives two parameters as one.

TENSOR_VARIABLE_LIST(...)

Pass a list of tensor variables to NNC functions that accepts (tensor variable array, tensor variable array size). This method effectively gives two parameters as one.

TENSOR_BIND_MAP(...)

Pass a list of tensor bindings to NNC functions that accepts (tensor binding array, tensor binding array size). This method effectively gives two parameters as one. Since tensor binding requires two: symbol and a tensor, you should use this like: TENSOR_BIND_MAP(KV(symbol1, tensor1), KV(symbol2, tensor2)).

TENSOR_SYMBOL_MAP(...)

Pass a list of tensor symbol pairs to NNC functions that accepts (tensor symbol pair array, tensor symbol pair array size). This method effectively gives two parameters as one. Since tensor symbol pair requires two: source symbol and destination symbol, you should use this like: TENSOR_SYMBOL_MAP(KV(symbol1, symbol2), KV(symbol3, symbol4)).

GRAPH_EXEC_LIST(...)

Pass a list of execution nodes to NNC functions that accepts (execution node array, execution node array size). This method effectively gives two parameters as one.

GRAPH_EXEC_SYMBOL_LIST(...)

Pass a list of execution node symbols to NNC functions that accepts (execution node symbol array, execution node symbol array size). This method effectively gives two parameters as one.

SYMBOLIC_GRAPH_SOURCES(x)

Pass both default sources and default sources size to function that accepts (sources, source size).

Parameters
  • x: A given symbolic graph.

SYMBOLIC_GRAPH_DESTINATIONS(x)

Pass both default destinations and default destinations size to function that accepts (destinations, destination size).

Parameters
  • x: A given symbolic graph.

SYMBOLIC_GRAPH_PASSES(...)

Pass a list of simplification passes to NNC functions that accepts (pass array, pass array size). This method effectively gives two parameters as one.

MODEL_LIST(...)

Pass a list of CNNP models to NNC functions that accepts (model array, model array size). This method effectively gives two parameters as one.

MODEL_IO_LIST(...)

Pass a list of CNNP model IOs to NNC functions that accepts (model IO array, model IO array size). This method effectively gives two parameters as one.

COLUMN_ID_LIST(...)

Pass a list of dataframe column ids to iteration function that accepts (column id array, column id array size). This method effectively gives two parameters as one.

TRAVERSE_FULL
CPU_NUMA_TENSOR_NHWC(device_id, ...)
CPU_NUMA_TENSOR_NCHW(device_id, ...)
CPU_NUMA_TENSOR_CHWN(device_id, ...)
ONE_CPU_NUMA_TENSOR
CPU_TENSOR_NHWC(...)
CPU_TENSOR_NCHW(...)
CPU_TENSOR_CHWN(...)
ONE_CPU_TENSOR
CPU_TENSOR_LABEL(...)
GPU_TENSOR_NHWC(device_id, ...)
GPU_TENSOR_NCHW(device_id, ...)
GPU_TENSOR_CHWN(device_id, ...)
ONE_GPU_TENSOR
HINT(...)

Simpler method to create hint. HINT(stride), HINT(stride, border), HINT(stride, border begin, border end)