DataFlow APIs
You can view the header file of each API in the ${INSTALL_DIR}/include/flow_graph directory.
Replace ${INSTALL_DIR} with the CANN component directory. For example, if the installation is performed by the root user, the default file storage path is /usr/local/Ascend/cann.
Note that the char_t type in the header file is the alias for the char type.
API Category |
Header File Path |
Description |
Matching Library File |
|---|---|---|---|
FlowOperator class |
flow_graph.h |
The FlowOperator class is the node base class of DataFlow graphs and is inherited from the Operator class of the GE. It cannot be independently constructed and used externally. |
N/A |
FlowData class |
flow_graph.h |
This class is the data node of DataFlow graphs and is inherited from the FlowOperator class. Each FlowData corresponds to one input. |
libflow_graph.so |
FlowNode class |
flow_graph.h |
This class is the compute node of DataFlow graphs and is inherited from the FlowOperator class. |
libflow_graph.so |
FlowGraph class |
flow_graph.h |
This class indicates a DataFlow graph, which consists of the input node FlowData and compute node FlowNode. |
libflow_graph.so |
ProcessPoint class |
process_point.h |
The ProcessPoint class is a virtual base class and cannot be instantiated as objects. |
N/A |
FunctionPp class |
process_point.h |
This class is the compute ProcessPoint of functions and is inherited from Class ProcessPoint. |
libflow_graph.so |
GraphPp class |
process_point.h |
This class is the compute ProcessPoint of graphs and is inherited from Class ProcessPoint. |
libflow_graph.so |
DataFlowInputAttr structure |
flow_attr.h |
This structure defines the timeBatch and countBatch functions to implement the batch capabilities of the UDF. |
libflow_graph.so |
DataFlow Graph Construction APIs
API |
Overview |
|---|---|
The FlowOperator class is the node base class of DataFlow graphs and is inherited from the Operator class of the GE. |
|
Constructs and destructs an object of class FlowData. The constructor returns a FlowData node. |
|
Constructs and destructs an object of class FlowNode. The constructor returns a FlowNode node. |
|
Sets the output ranked src_index of src_op as the input ranked dst_index of FlowNode, and returns a FlowNode node with the input set. |
|
Adds a mapping ProcessPoint to a FlowNode node. Currently, only one ProcessPoint can be added to a FlowNode node. After a ProcessPoint is added, the input and output of the FlowNode node are mapped to those of the ProcessPoint in sequence by default. |
|
Maps inputs to FlowNode, indicating that the node_input_index input of FlowNode is sent to the pp_input_index input of ProcessPoint, all attributes in attrs are set for the input of ProcessPoint, and the mapped FlowNode is returned. This function is optional. If it is not called, the inputs of FlowNode and ProcessPoint are mapped in sequence by default. |
|
Maps the output ranked pp_output_index of ProcessPoint to the output ranked node_output_index of FlowNode, and returns FlowNode with the output mapped. |
|
Sets the balance scatter attribute. The UDF with the balance scatter attribute can use balance options to set the load balancing output. |
|
Sets the balance gather attribute. The UDF with the balance gather attribute can use balance options to set the load balancing and affinity output. |
|
Constructs and destructs an object of class FlowGraph. The constructor returns an empty FlowGraph graph. |
|
Sets the input of FlowGraph. An empty FlowGraph will be built based on node output connections and then returned. |
|
Sets the output node of the FlowGraph and returns the graph. |
|
Sets the association between the FlowNode and FlowNode output index in the FlowGraph and returns the graph. It is usually used to set some output of FlowNodes. For example, FlowNode1 has two outputs, but only one output of FlowNode1 is required when FlowNode2 is used as the input. In this case, you can set an output index of FlowNode1. |
|
Sets whether FlowGraph contains an n_mapping node. |
|
Sets the attribute of input alignment in FlowGraph. |
|
Converts FlowGraph into a GE graph. |
|
Sets whether the builder of GraphPp in FlowGraph is executed asynchronously. |
|
Sets whether to enable the user exception capture function. |
|
Destructs an object of class ProcessPoint. |
|
Obtains the type of ProcessPoint. |
|
Obtains the name of ProcessPoint. |
|
Obtains the compilation configuration file of ProcessPoint. |
|
Serializes ProcessPoint. The function of this API is implemented by the subclass of ProcessPoint. |
|
Constructs and destructs an object of class FunctionPp. The constructor returns an object of class FunctionPp. |
|
Sets the name and path of the JSON configuration file of FunctionPp. The configuration file is used to map FunctionPp to UDF. |
|
Adds GraphPp called by FunctionPp, and returns FunctionPp with GraphPp added. |
|
Adds GraphPp called by FunctionPp, and returns FunctionPp with GraphPp added. |
|
Adds FlowGraphPp called by FunctionPp, and returns FunctionPp with FlowGraphPp added. |
|
Sets the initialization parameter of FunctionPp, and returns FunctionPp with the initialization parameter set. |
|
Serializes FunctionPp. |
|
Obtains GraphPp called by FunctionPp. |
|
Constructs and destructs an object of class GraphPp. The constructor returns an object of class GraphPp. |
|
Sets the path and name of the JSON configuration file of GraphPp. The configuration file is used to describe and compile AscendGraph. |
|
Serializes GraphPp. |
|
Obtains the graph creation function in GraphPp. |
|
Constructs and destructs an object of class FlowGraphPp. The constructor returns an object of class FlowGraphPp. |
|
Serializes FlowGraphPp. |
|
Obtains the graph creation function in FlowGraphPp. |
|
The TimeBatch function is based on the UDF. A model normally processes a piece of data each time. When it needs to process many pieces of data at a time, these pieces of data need to be combined into a batch. The basic mode is to combine the N pieces of data and add N before the shape. In some scenarios, data of one or more time segments needs to be combined into a batch based on a specific dimension, which can be implemented using the TimeBatch function. |
|
CountBatch is used to combine multiple data records into batches based on batchSize, by using UDFs as compute ProcessPoints. |
DataFlow Execution APIs
API |
Overview |
|---|---|
Inputs all data to a graph. |
|
Inputs data to a graph by index. |
|
Inputs data to a graph. |
|
Inputs data to a graph by index. |
|
Inputs raw data to a graph. |
|
Fetches output data of a graph. |
|
Fetches output data of a graph by index. |
|
Fetches output data of a graph. |
|
Fetches output data of a graph by index. |
|
Constructs and destructs an object of class DataFlowInfo. |
|
Sets user information. |
|
Obtains user information. |
|
Sets the start timestamp of data. |
|
Obtains the start timestamp of data. |
|
Sets the end timestamp of data. |
|
Obtains the end timestamp of data. |
|
Sets flags in data. |
|
Obtains flags in data. |
|
Sets the transaction ID used for DataFlow data transmission. |
|
Obtains the transaction ID used for DataFlow data transmission. |
|
Constructs and destructs an object of class FlowMsg. |
|
Obtains the message type of FlowMsg. |
|
Sets the message type of FlowMsg. |
|
Obtains the tensor pointer in FlowMsg. |
|
Obtains the error code in the input FlowMsg. |
|
Sets the error code in FlowMsg. |
|
Sets the start timestamp in the FlowMsg message header. |
|
Obtains the start timestamp in FlowMsg. |
|
Sets the end timestamp in the FlowMsg message header. |
|
Obtains the end timestamp in FlowMsg. |
|
Sets flags in the FlowMsg message header. |
|
Obtains flags in the FlowMsg message header. |
|
Obtains the transaction ID in FlowMsg. |
|
Sets the transaction ID in FlowMsg. |
|
Sets user information. |
|
Obtains user information. |
|
Obtains the pointer to and size of data of the RawData type. |
|
Allocates tensors based on the shape, data type, and alignment size. |
|
Allocates FlowMsg based on the shape, data type, and alignment size. |
|
Allocates a continuous memory block based on the input size to carry the raw data. |
|
Allocates a message of the MsgType type that carries empty data. |
|
Converts the input tensor to FlowMsg that carries tensors. |
|
Converts the input raw data to FlowMsg that carries the raw data. |