Level 3 API

Essentials

enum [anonymous]::__anonymous80

Values:

CCV_NNC_TENSOR_SYMBOL_INIT_ZEROS = 0x01

Initialize underlying tensor for the symbol with zeros

CCV_NNC_TENSOR_SYMBOL_TAPE_VAR = 0x02

Mark this as a tape variable (it cannot be folded, will contain flag CCV_TAPE_ALLOC)

CCV_NNC_TENSOR_SYMBOL_DEAD = 0x80000000

Mark this tensor symbol as dead, any future usage will cause assertion

enum [anonymous]::__anonymous81

Values:

CCV_NNC_GRAPH_EXEC_DEAD = 0x1

Mark this node as dead.

CCV_NNC_GRAPH_EXEC_P_WHILE = 0x10

Mark this node keyword is while

CCV_NNC_GRAPH_EXEC_CASE_OF = 0x20

Mark this node keyword is case_of

enum [anonymous]::__anonymous82

Values:

CCV_NNC_NO_TENSOR_SYMBOL = -1

Special symbol reference for no tensor symbol.

CCV_NNC_WHILE_COUNT_TENSOR_SYMBOL = -2

Special symbol reference for while loop count tensor.

enum [anonymous]::__anonymous83

Values:

CCV_NNC_AUTOGEN_ALL_EXECS = 0x1

Automatic concatenation for all execution nodes

CCV_NNC_AUTOGEN_SOURCES_AND_DESTINATIONS = 0x2

Automatically find all source and destination nodes.

typedef struct ccv_nnc_symbolic_graph_s ccv_nnc_symbolic_graph_t

Opaque pointer to the symbolic graph object.

typedef struct ccv_nnc_tensor_arena_s ccv_nnc_tensor_arena_t

Opaque pointer to an arena of allocated tensors.

typedef struct ccv_nnc_graph_exec_arena_s ccv_nnc_graph_exec_arena_t

Opaque pointer to an arena of allocated execs.

ccv_nnc_symbolic_graph_new(void)

Create a new empty symbolic graph. It is an opaque data structure that maintains the whole graph of computation in its symbolic form. Note that all graph mutation methods are not thread-safe. You should only operate the graph in serial fashion.

ccv_nnc_tensor_symbol_new(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_tensor_param_t info, const char *const name)

Create an tensor symbol (thus, with no actual memory space allocation) in a symbolic graph.

Return
A tensor symbol reference.
Parameters
  • graph: The symbolic graph.
  • info: The tensor parameters.
  • name: The name of the tensor symbol, it is optional.

ccv_nnc_tensor_symbol_alias_new(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_tensor_symbol_t tensor_symbol, const int ofs[CCV_NNC_MAX_DIM_ALLOC], const int inc[CCV_NNC_MAX_DIM_ALLOC], const ccv_nnc_tensor_param_t info, const char *const name)

Create an alias to the tensor symbol as tensor view (thus, pointing to the same memory region, but with a different header info and offset).

Return
A tensor symbol alias reference.
Parameters
  • graph: The symbolic graph.
  • tensor_symbol: The tensor symbol we are going to reference to.
  • ofs: The offset on each of the dimension.
  • inc: The line size of each dimension.
  • info: The tensor parameters for the new alias.
  • name: The name of the tensor symbol alias, it is optional.

void ccv_nnc_tensor_symbol_free(ccv_nnc_symbolic_graph_t *const graph, ccv_nnc_tensor_symbol_t tensor)

Manually delete a tensor symbol off the symbolic graph.

Parameters
  • graph: The symbolic graph.
  • tensor: The tensor symbol reference.

ccv_nnc_graph_exec_symbol_t ccv_nnc_graph_exec_symbol_new(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_cmd_t cmd, const ccv_nnc_tensor_symbol_t *const inputs, const int input_size, const ccv_nnc_tensor_symbol_t *const outputs, const int output_size, const char *const name)

Create a graph execution node (an operation that takes a set of inputs and generates a set of outputs).

Return
The execution node symbol reference.
Parameters
  • graph: The symbolic graph.
  • cmd: The wrapped command.
  • inputs: The input tensor symbols array.
  • input_size: The size of input tensor symbols array.
  • outputs: The output tensor symbols array.
  • output_size: The size of output tensor symbols array.
  • name: The name of this execution node, optional.

void ccv_nnc_graph_exec_symbol_set_hint(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_graph_exec_symbol_t exec, const ccv_nnc_hint_t hint)

ccv_nnc_graph_exec_symbol_new defaults to use `ccv_nnc_hint_auto` find the best hints for a set of inputs / outputs. However, you can also set your own hints.

Parameters
  • graph: The symbolic graph.
  • exec: The execution node symbol reference.
  • hint: The hint for the command.

void ccv_nnc_graph_exec_symbol_free(ccv_nnc_symbolic_graph_t *const graph, ccv_nnc_graph_exec_symbol_t symbol)

Manually delete a exec symbol off the symbolic graph.

Parameters
  • graph: The symbolic graph.
  • symbol: The execution node symbol reference.

int ccv_nnc_graph_exec_symbol_autogen(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_graph_exec_symbol_t *const execs, const int exec_size, const int flags)

Automatic concatenate these nodes together based on its inputs / outputs. Imagining this is to generate the execution flow based on input tensors and output tensors. nil for execs and 0 for exec_size means to loop over all the execs on the graph and autogen.

Return
non-zero if cannot figure out.
Parameters
  • graph: The symbolic graph.
  • execs: The execution nodes array.
  • exec_size: The size of execution nodes array.
  • flags: The flags determines what operations to perform when concatenating.

void ccv_nnc_symbolic_graph_set_sources(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_graph_exec_symbol_t *const sources, const int source_size)

Set the default sources for a symbolic graph.

Parameters
  • graph: The symbolic graph.
  • sources: The source execution nodes array.
  • source_size: The size of source execution nodes array.

ccv_nnc_graph_exec_symbol_t *ccv_nnc_symbolic_graph_sources(const ccv_nnc_symbolic_graph_t *const graph)

Get the pointer to the default sources.

Return
The pointer to the source execution nodes array.
Parameters
  • graph: The symbolic graph.

int ccv_nnc_symbolic_graph_source_size(const ccv_nnc_symbolic_graph_t *const graph)

Get the size of the default source nodes array.

Return
The size of the default source nodes array.
Parameters
  • graph: The symbolic graph.

void ccv_nnc_symbolic_graph_set_destinations(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_graph_exec_symbol_t *const destinations, const int destination_size)

Set the default destinations for a symbolic graph.

Parameters
  • graph: The symbolic graph.
  • destinations: The destination execution nodes array.
  • destination_size: The size of destination execution nodes array.

ccv_nnc_graph_exec_symbol_t *ccv_nnc_symbolic_graph_destinations(const ccv_nnc_symbolic_graph_t *const graph)

Get the pointer to the default destinations.

Return
The pointer to the destinationsexecution nodes array.
Parameters
  • graph: The symbolic graph.

int ccv_nnc_symbolic_graph_destination_size(const ccv_nnc_symbolic_graph_t *const graph)

Get the size of the default destination nodes array.

Return
The size of the default destination nodes array.
Parameters
  • graph: The symbolic graph.

void ccv_nnc_symbolic_graph_dot(const ccv_nnc_symbolic_graph_t *const graph, const int flags, FILE *out)

Generate output that can be parsed by GraphViz (DOT language).

Parameters
  • graph: The symbolic graph.
  • flags: Either CCV_NNC_SHORT_DOT_GRAPH or CCV_NNC_LONG_DOT_GRAPH
  • out: The output file stream.

void ccv_nnc_symbolic_graph_compile(const ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_tensor_bind_t *const tensor_binds, const int tensor_bind_size, const ccv_nnc_tensor_symbol_t *const outputs, const int output_size, const ccv_nnc_graph_exec_symbol_t *const sources, const int source_size, const ccv_nnc_graph_exec_symbol_t *const destinations, const int destination_size, ccv_nnc_graph_t **const graph_ref, ccv_nnc_tensor_arena_t **const tensor_arena_ref, ccv_nnc_graph_exec_arena_t **const graph_exec_arena_ref)

Compile a symbolic graph into a graph that can be executed, and a set of tensors (opaque data structure tensor arena) are allocated based on which tensor symbols are the input and which are the outputs. The tensor allocation is done to minimize the required storage. tensor_binds provide custom binding for these tensors. You still responsible to manage the life-time of these tensors. outputs marks the tensor symbols that need to be kept til the end of the graph.

Parameters
  • graph: The symbolic graph.
  • tensor_binds: The binding array (a tensor symbol and a concrete tensor). We replace everywhere that uses the tensor symbol with the concrete tensor.
  • tensor_bind_size: The size of the binding array.
  • outputs: The output tensor symbols that we want to keep the value.
  • output_size: The size of the output tensor symbols array.
  • sources: The sources for the graph.
  • source_size: The size of the sources array. 0 to use default sources.
  • destinations: The destinations for the graph.
  • destination_size: The size of the destinations array. 0 to use default destinations.
  • graph_ref: The pointer to store the generated concrete graph.
  • tensor_arena_ref: The pointer to store ccv_nnc_tensor_arena_t.
  • graph_exec_arena_ref: The pointer to store ccv_nnc_graph_exec_arena_t.

void ccv_nnc_symbolic_graph_free(ccv_nnc_symbolic_graph_t *const graph)

Free the symbolic graph and its associated memory. Note that if you compiled a graph / tensor arena out of this symbolic graph, these won’t be free’d.

Parameters
  • graph: The symbolic graph.

ccv_nnc_tensor_from_symbol(const ccv_nnc_tensor_arena_t *const tensor_arena, const ccv_nnc_tensor_symbol_t symbol)

Find corresponding tensor by a symbol from the tensor arena.

Return
A concrete tensor from the tensor arena.
Parameters
  • tensor_arena: The tensor arena object generated through compilation,
  • symbol: The tensor symbol reference. Because tensor symbol reference is on stack. It can still be used even the original symbolic graph is free’d.

void ccv_nnc_tensor_bind_symbol(const ccv_nnc_tensor_arena_t *const tensor_arena, const ccv_nnc_tensor_symbol_t symbol, const ccv_nnc_tensor_t *const tensor)

Bind a tensor to a symbol. You still responsible to manage the life-time of the tensor to make sure it is not freed until everything is done.

Parameters
  • tensor_arena: The tensor arena object generated through compilation.
  • symbol: The tensor symbol reference. Because tensor symbol reference is on stack. It can still be used even the original symbolic graph is free’d.
  • tensor: The new tensor to bind to.

void ccv_nnc_tensor_arena_free(ccv_nnc_tensor_arena_t *const tensor_arena)

Free the opaque tensor arena structure.

Parameters
  • tensor_arena: The tensor arena object generated through compilation.

ccv_nnc_graph_exec_from_symbol(const ccv_nnc_graph_exec_arena_t *const graph_exec_arena, const ccv_nnc_graph_exec_symbol_t symbol)

Find corresponding graph exec by a exec symbol from graph exec arena.

Return
A execution node reference to the concrete graph.
Parameters
  • graph_exec_arena: The graph execution node arena object generated through compilation,
  • symbol: The execution node symbol reference. Because execution node symbol reference is on stack. It can still be used even the original symbolic graph is free’d.

ccv_nnc_graph_exec_source(const ccv_nnc_graph_exec_arena_t *const graph_exec_arena)

Return the node that can drive all the source nodes from the compilation.

Return
A execution node reference that is the source.
Parameters
  • graph_exec_arena: The graph execution node arena object generated through compilation,

ccv_nnc_graph_exec_destination(const ccv_nnc_graph_exec_arena_t *const graph_exec_arena)

Return the node that can drain all the destination nodes from the compilation.

Return
A execution node reference that is the destination.
Parameters
  • graph_exec_arena: The graph execution node arena object generated through compilation,

void ccv_nnc_graph_exec_arena_free(ccv_nnc_graph_exec_arena_t *const graph_exec_arena)

Free the opaque graph exec arena structure.

Parameters
  • graph_exec_arena: The graph execution node arena object generated through compilation,

void ccv_nnc_symbolic_graph_write(const ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_tensor_bind_t *const tensor_binds, const int tensor_bind_size, const char *const fn)

Write symbolic graph to disk, along with some binding tensors.

Parameters
  • graph: The symbolic graph.
  • tensor_binds: The binding array (pair of tensor symbol and concrete tensor).
  • tensor_bind_size: The size of the binding array.
  • fn: The file name.

void ccv_nnc_symbolic_graph_read(const char *const fn, ccv_nnc_symbolic_graph_t **const graph_ref, ccv_nnc_tensor_bind_t **const tensor_binds_ref, int *const tensor_bind_size_ref)

Read symbolic graph from disk, with some binding tensors.

Parameters
  • fn: The file name.
  • graph_ref: The pointer to store symbolic graph.
  • tensor_binds_ref: The pointer to store the binding array.
  • tensor_bind_size_ref: The pointer to store the size of the binding array.

CCV_NNC_TENSOR_SYMBOL_IS_DEAD(x)
CCV_NNC_GRAPH_EXEC_IS_DEAD(x)
CCV_NNC_GRAPH_REF(x)
CCV_NNC_IS_WHILE_COUNT_TENSOR_SYMBOL(d)
struct ccv_nnc_tensor_symbol_t
#include <ccv_nnc.h>

On stack object references a tensor symbol in the symbolic graph.

struct ccv_nnc_graph_exec_symbol_t
#include <ccv_nnc.h>

On stack object references a execution node symbol in the symbolic graph.

struct ccv_nnc_tensor_symbol_map_t
#include <ccv_nnc.h>

A data structure to pass in a pair of tensor symbols.

Public Members

ccv_nnc_tensor_symbol_t source

The ‘from’ tensor symbol.

ccv_nnc_tensor_symbol_t destination

The ‘to’ tensor symbol.

struct ccv_nnc_tensor_bind_t
#include <ccv_nnc.h>

The data structure to wrap a tensor symbol and a concrete tensor together.

Others

typedef ccv_nnc_cmd_t (*ccv_nnc_symbolic_graph_subst_f)(const ccv_nnc_graph_exec_symbol_t symbol, const ccv_nnc_cmd_t cmd)

Substitution function. Given an execution node symbol and a command, return a new command.

typedef void (*ccv_nnc_tensor_symbol_new_hook_f)(void *context, const ccv_nnc_tensor_symbol_t symbol, const ccv_nnc_tensor_param_t info, const char *const name)

Function prototype for tensor symbol creation callback.

typedef void (*ccv_nnc_tensor_symbol_alias_new_hook_f)(void *context, const ccv_nnc_tensor_symbol_t symbol, const ccv_nnc_tensor_symbol_t from_symbol, const int ofs[CCV_NNC_MAX_DIM_ALLOC], const int inc[CCV_NNC_MAX_DIM_ALLOC], const ccv_nnc_tensor_param_t info, const char *const name)

Function prototype for tensor symbol alias creation callback.

typedef void (*ccv_nnc_graph_exec_symbol_new_hook_f)(void *context, const ccv_nnc_graph_exec_symbol_t symbol, const ccv_nnc_cmd_t cmd, const ccv_nnc_tensor_symbol_t *const inputs, const int input_size, const ccv_nnc_tensor_symbol_t *const outputs, const int output_size, const char *const name)

Function prototype for execution node symbol creation callback.

ccv_nnc_tensor_symbol_alias_to(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_tensor_symbol_t tensor_symbol)

Return the symbol it alias to.

Return
A tensor symbol reference to the original tensor symbol.
Parameters
  • graph: The symbolic graph.
  • tensor_symbol: The tensor symbol alias.

int ccv_nnc_tensor_symbol_set(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_tensor_symbol_t tensor, const ccv_nnc_tensor_param_t info)

Set the tensor symbol parameters.

Return
non-zero if encountered errors.
Parameters
  • graph: The symbolic graph.
  • tensor: The tensor symbol reference.
  • info: The new tensor parameters.

ccv_nnc_tensor_symbol_params(const ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_tensor_symbol_t tensor)

Get the parameters for a tensor symbol.

Return
The tensor parameters.
Parameters
  • graph: The symbolic graph.
  • tensor: The tensor symbol reference.

int ccv_nnc_tensor_symbol_set_flags(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_tensor_symbol_t tensor, const int flags)

Set the flags for this tensor symbol. The flags are only used for symbol, not for tensor.

Parameters
  • graph: The symbolic graph.
  • tensor: The tensor symbol reference.
  • flags: A reserved field for flags.

ccv_nnc_tensor_symbol_flags(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_tensor_symbol_t tensor)

Get all the flags for a tensor.

Parameters
  • graph: The symbolic graph.
  • tensor: The tensor symbol reference.

void ccv_nnc_graph_exec_symbol_set(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_graph_exec_symbol_t exec, const ccv_nnc_cmd_t cmd)

Set the cmd of this exec symbol.

Parameters
  • graph: The symbolic graph.
  • exec: The execution node symbol reference.
  • cmd: The new wrapped command.

ccv_nnc_graph_exec_symbol_cmd(const ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_graph_exec_symbol_t exec)

Return the command on this exec symbol.

Return
The wrapped command.
Parameters
  • graph: The symbolic graph.
  • exec: The execution node symbol reference.

void ccv_nnc_graph_exec_symbol_set_io(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_graph_exec_symbol_t exec, const ccv_nnc_tensor_symbol_t *const inputs, const int input_size, const ccv_nnc_tensor_symbol_t *const outputs, const int output_size)

Set the inputs / outputs for a exec symbol.

Parameters
  • graph: The symbolic graph.
  • exec: The execution node symbol reference.
  • inputs: The input tensor symbols array.
  • input_size: The size of input tensor symbols array.
  • outputs: The output tensor symbols array.
  • output_size: The size of output tensor symbols array.

int ccv_nnc_graph_exec_symbol_concat(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_graph_exec_symbol_t source, const ccv_nnc_graph_exec_symbol_t destination)

Manually concatenate input node with an output graph node.

Return
non-zero if cannot concat successfully.
Parameters
  • graph: The symbolic graph.
  • source: The source execution node symbol to connect.
  • destination: The destination execution node symbol connect to.

int ccv_nnc_graph_exec_symbol_disjoin(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_graph_exec_symbol_t source, const ccv_nnc_graph_exec_symbol_t destination)

Manually disconnect input node with an output graph node for this graph.

Return
non-zero if cannot disjoin successfully.
Parameters
  • graph: The symbolic graph.
  • source: The source execution node symbol to disconnect.
  • destination: The destination execution node symbol disconnect to.

ccv_nnc_graph_exec_symbol_count(const ccv_nnc_symbolic_graph_t *const graph)

Number of exec symbols.

Parameters
  • graph: The symbolic graph.

ccv_nnc_symbolic_graph_dup(const ccv_nnc_symbolic_graph_t *const graph, ccv_nnc_symbolic_graph_subst_f subst)

Generate a duplicate of the provided graph. While generating the duplicate, it calls the function pointer to re-process the node type.

Return
The duplicated symbolic graph.
Parameters
  • graph: The symbolic graph.
  • subst: The substitution function.

ccv_nnc_tensor_symbol_resolve(const ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_tensor_symbol_t tensor_symbol)

For a given tensor symbol, this method resolves to its local reference inside the given graph. This is related to the sub-graph of symbolic graphs. A tensor symbol in the sub-graph can still have a representation in the parent graph. This method used to find the local reference in any graph.

Return
A tensor symbol reference in the given graph.
Parameters
  • graph: The symbolic graph.
  • tensor_symbol: The tensor symbol we want to resolve.

void ccv_nnc_tensor_symbol_hookup(ccv_nnc_symbolic_graph_t *const src_graph, ccv_nnc_symbolic_graph_t *const dest_graph, const ccv_nnc_tensor_symbol_t src_tensor_symbol, const ccv_nnc_tensor_symbol_t dest_tensor_symbol)

Pass graph’s tensor symbol into its sub graph. We will make the connection that the source tensor symbol in the source symbolic graph is the destination tensor symbol in the destination symbolic graph. The reason to do this inference is because a tensor symbol is local to a symbolic graph under the hood. Although you can use tensor symbols from different graphs directly (it calls this method or the resolve method above when create an execution node symbol), sometimes you need this method to do it manually.

Parameters
  • src_graph: The source symbolic graph.
  • dest_graph: The destination symbolic graph.
  • src_tensor_symbol: The tensor symbol we want to resolve.
  • dest_tensor_symbol: The tensor symbol we want to resolve.

void ccv_nnc_tensor_symbol_set_bypasses(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_tensor_symbol_map_t *const symbol_map, const int symbol_map_size)

Set bypasses for a tensor symbol. For case..of graphs, if the condition doesn’t meet, we will skip the execution of a sub-graph. However, in that case, we cannot express easily which output tensor corresponds to which input tensor. This methods provides the way.

Parameters
  • graph: The symbolic graph.
  • symbol_map: The pair of tensors array, source is the input tensor, destination is the output tensor.
  • symbol_map_size: The size of the tensor pairs array.

void ccv_nnc_graph_exec_symbol_io(const ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_graph_exec_symbol_t symbol, const int **const inputs, int *const input_size, const int **const outputs, int *const output_size)

Fetch input / output for an exec symbol. For efficiency consideration, this returns pointer directly.

Parameters
  • graph: The symbolic graph.
  • symbol: The execution node symbol reference.
  • inputs: The pointer to store input tensor symbols array.
  • input_size: The pointer to store the size of input tensor symbols array.
  • outputs: The pointer to store output tensor symbols array.
  • output_size: The pointer to store the size of output tensor symbols array.

void ccv_nnc_graph_exec_symbol_to(const ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_graph_exec_symbol_t symbol, const int **const tos, int *const to_size)

Which exec symbol this is connected to. For efficiency consideration, this returns pointer directly.

Parameters
  • graph: The symbolic graph.
  • symbol: The execution node symbol reference.
  • tos: The pointer to store outgoing indexes of the execution nodes.
  • to_size: the pointer to store the number of outgoing indexes.

void *ccv_nnc_tensor_symbol_new_hook(ccv_nnc_symbolic_graph_t *const graph, ccv_nnc_tensor_symbol_new_hook_f hook, void *context)

Hook into the call to ccv_nnc_tensor_symbol_new, return previous provided context if call into this method.

Parameters
  • graph: The symbolic graph.
  • hook: The function to be called if a new tensor symbol created.
  • context: The context associated with the callback function.

void *ccv_nnc_tensor_symbol_alias_new_hook(ccv_nnc_symbolic_graph_t *const graph, ccv_nnc_tensor_symbol_alias_new_hook_f hook, void *context)

Hook into the call to ccv_nnc_tensor_symbol_alias_new, return previous provided context if call into this method.

Parameters
  • graph: The symbolic graph.
  • hook: The function to be called if a new tensor symbol alias created.
  • context: The context associated with the callback function.

void ccv_nnc_tensor_symbol_set_peer(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_tensor_symbol_t tensor_symbol, const ccv_nnc_tensor_symbol_t peer_tensor_symbol)

Set the peer reference for tensor symbols. Peer reference for tensor symbols has very specific meanings. For a backward pass involves sub-graphs. The commands in the sub-graph could reference to tensor symbols of a different graph (its forward pass graph). That is not allowed (two graph has no ancestral relationship cannot share a tensor symbol). So we create a new tensor symbol, but set the peer reference.

Parameters
  • graph: The symbolic graph.
  • tensor_symbol: The tensor symbol in the current graph.
  • peer_tensor_symbol: The tensor symbol in the peer graph.

void *ccv_nnc_graph_exec_symbol_new_hook(ccv_nnc_symbolic_graph_t *const graph, ccv_nnc_graph_exec_symbol_new_hook_f hook, void *context)

Hook into the call to ccv_nnc_graph_exec_symbol_new, return previous provided context if call into this method.

Parameters
  • graph: The symbolic graph.
  • hook: The function to be called if a new execution node symbol created.
  • context: The context associated with the callback function.

void ccv_nnc_graph_exec_symbol_set_peer(ccv_nnc_symbolic_graph_t *const graph, const ccv_nnc_graph_exec_symbol_t exec_symbol, const ccv_nnc_graph_exec_symbol_t peer_exec_symbol)

Set the peer reference for exec. This is very similar to the one for concrete graph. A peer reference of a backward pass execution node is its forward pass counterpart.

Parameters
  • graph: The symbolic graph.
  • exec_symbol: The execution node symbol in the current graph.
  • peer_exec_symbol: The peering execution node symbol.