API Lists
This section mainly describes secure, easy-to-use graph construction APIs for app users or high-level frameworks to build models and set model graphs, operators in the graphs, and the inputs, outputs, and other operator attributes.
aclgrph APIs
|
API |
Function |
Header File/Library File |
|---|---|---|
|
Parses a Caffe model into a graph. |
The The |
|
|
Parses an ONNX model into a graph. |
||
|
Parses an ONNX model loaded to the memory into a graph. |
||
|
Parses a TensorFlow model into a graph. |
||
|
Initializes model build, for allocating resources. |
|
|
|
Destroys allocations after model building. |
||
|
Builds an input graph into an offline model adapted to the Ascend AI Processor and saves it to the memory buffer. |
||
|
The difference between this API and aclgrphBuildModel is that this API applies to the weight update scenario. After the offline model cache is generated using the aclgrphBundleBuildModel API, aclgrphBundleSaveModel needs to be called to flush the cache to disks. |
||
|
Serializes an offline model to a file. |
||
|
Converts the original graph into a group of graphs whose weights can be updated by passing the const node name array. |
||
|
Dumps the input graph to a text file. |
||
|
Obtains the version number of the API related to model build. |
||
|
Builds a graph based on the single-operator information or JSON file of a single-operator. |
||
|
Serializes an offline model to a file. |
||
|
Sets node attributes to modify a graph. |
||
|
Quantizes a graph. For details about the application scenarios, see Quantization. |
|
|
|
Creates a Profiling configuration. |
The |
|
|
Destroys the Profiling configuration. |
||
|
Finalizes Profiling. |
||
|
Initializes Profiling and sets Profiling parameters. (Currently, you can specify the path for saving profile data files.) |
||
|
Starts profile data collection. |
||
|
Stops profile data collection. |
Session APIs
|
Category |
API |
Function |
Header File/Library File |
|---|---|---|---|
|
Session |
Constructs or destroys an object of class Session. |
This feature is not supported by the |
|
|
Adds a graph to a Session, in which a unique graph ID is generated. |
|||
|
Adds a graph to a Session, in which a unique graph ID is generated. |
|||
|
Builds the graph of a specified ID to generate an executable model. This API is synchronous. |
|||
|
Synchronously compiles the graph corresponding to the specified ID. Compared with BuildGraph, this API provides only the graph compilation function and does not generate executable models. BuildGraph contains the graph build process, initializes the memory resources required by the model after the process, and generates an executable model. |
|||
|
Runs the graph of a specified ID and returns the execution result. This API is asynchronous. |
|||
|
Initializes GE. |
|||
|
Queries the summary information about the graph compilation result. The summary information includes the feature memory size, const memory size, number of streams and events, and whether the memory can be updated. |
|||
|
Finalizes GE and destroys associated allocations. |
|||
|
Obtains and clears the error message returned by other API call failure in the calling process or thread. |
|||
|
Obtains and clears the error message returned by other API call failure in the process or thread. |
|||
|
Obtains and clears the warning message returned by other API call failure in the process or thread. |
|||
|
Obtains and clears the warning message returned by other API call failure in the calling process or thread. |
|||
|
Obtains the session ID. |
|||
|
Queries variables and obtains Tensor information of all variable operators or of a specified variable operator within a Session. |
|||
|
Determines whether a graph needs to be recompiled. |
|||
|
Binds a graph with a specified ID to a stream in asynchronous graph execution scenarios. |
|||
|
Determines whether the memory can be quickly recovered when an uncorrectable error (UCE) occurs in the memory. |
|||
|
Registers a callback function. |
|||
|
Registers an external allocator to the GE. This applies to the scenario where the user's memory pool is used. |
|||
|
Removes a graph specified by graphId from a Session. |
|||
|
Runs the graph of a specified ID and returns the execution result. This API is synchronous. |
|||
|
Runs the graph of a specified ID and returns the running result. This API is asynchronous. |
|||
|
Runs the graph corresponding to a specified ID synchronously after the input refdata node is partitioned, and outputs the running result. |
|||
|
Runs the graph of a specified ID and returns the running result. This API is asynchronous. This API is used to build, load, and run graphs. |
|||
|
This API is deprecated. Avoid using it. Saves graphs in a session as a .pb file. Weight sharing in a session is supported. That is, if two graphs in a session have the same weight, only one weight is saved. |
|||
|
Sets the const memory base address of a graph. |
|||
|
Sets the memory base address of the fixed feature of a graph. |
|||
|
Sets the base address of the fixed feature memory of different memory types in a graph. |
|||
|
This API is deprecated. Avoid using it. This API shards graphs in a session based on the AddGraph sequence. Sharded graphs are saved in the memory. |
|||
|
This API is deprecated. Avoid using it. Shard a graph in a session based on the AddGraph sequence. Sharded graphs are saved as .pb files. |
|||
|
Updates the feature memory base address of a graph. |
|||
|
Updates the base address of the feature memory that can be updated except fixed memory. |
|||
|
Destroys the allocator registered by the user based on the stream. This applies to the scenario where the user's memory pool is used. |
|||
|
GESession |
Constructs and destructs an object of class GeSession. |
This feature is not supported by the |
|
|
Adds a graph to a GeSession, in which a unique graph ID is generated. |
|||
|
Adds a graph to a GeSession, in which a unique graph ID is generated. |
|||
|
Synchronously compiles the graph corresponding to the specified ID. |
|||
|
Finalizes the GE and releases GE resources. |
|||
|
Obtains and clears the error messages returned by other failed API calls in the same process or thread. |
|||
|
Obtains and clears the warning information returned by other failed API calls in the same process or thread. |
|||
|
Initializes GE for running. |
|||
|
Queries the summary information about the graph compilation result. The summary information includes the feature memory size, const memory size, numbers of streams and events, and whether the memory can be updated. |
|||
|
Obtains the serialized model after graph compilation. |
|||
|
Obtains the ID of a session. |
|||
|
Determines whether a graph needs to be rebuilt. |
|||
|
Loads a graph and prepares for its execution, including allocating and managing resources such as memory and computational streams required for graph execution. |
|||
|
Registers a callback function. |
|||
|
Registers a user's Allocator to the GE. This applies to the scenario where the user's memory pool is used. |
|||
|
Removes a graph with a specified ID from the current GeSession. |
|||
|
Runs the graph of a specified ID and returns the execution result. This API is synchronous. |
|||
|
Runs the graph of a specified ID and returns the running result. This API is asynchronous. |
|||
|
Runs the graph of a specified ID and returns the execution result. This API is asynchronous. |
|||
|
Sets the const memory base address of a graph. |
|||
|
Sets the base address of the fixed feature memory of different memory types in a graph. |
|||
|
Updates the feature memory base address of a graph. |
|||
|
Updates the base address of the feature memory that can be updated except fixed memory. |
|||
|
Destroys the allocator registered by the user based on the stream. This applies to the scenario where the user's memory pool is used. |
ES APIs
|
Category |
API |
Function |
Header File/Library File |
|---|---|---|---|
|
Class and structure |
Node builder class. This class is used to build graph nodes that comply with the IR specifications. This class provides chain APIs to define the IR input, output, and attributes of a node, ensuring that the generated node complies with the IR specifications. This class is called internally by ES generated APIs. If you directly build a graph by calling an ES generated API, you do not need to be aware of this class. To customize ES APIs, use the capabilities provided by this class to build nodes. |
#include "compliant_node_builder.h" |
|
|
C-style graph builder structure, which is an internal implementation class of C and C++. C users call esb_funcs.h to build graphs, and C++ users call external APIs of the EsGraphBuilder class. |
#include <es_c_graph_builder.h> |
||
|
C-style output type of the ES API. C users call esb_funcs.h to build graphs, and C++ users call external APIs of the EsTensorHolder class. |
#include <es_c_tensor_holder.h> |
||
|
Graph builder class. This class is used by C++ users to build computational graphs. This class provides methods for creating graph elements such as inputs, setting private attributes, building final graphs, and calling the conversion logic of the ES generated API of C by the inline function of the ES generated API of C++. |
#include "es_graph_builder.h" |
||
|
Node output expression class. This class is used for C++ graph building. This class provides the tensor operation APIs of C and provides various operations on node outputs, including setting the data type, format, and shape, setting private attributes, and performing arithmetic operations. |
#include "es_tensor_holder.h" |
||
|
Generic EsTensorHolder class. This class is used to convert scalar and vector values into EsTensorHolder objects so that the C++ graph building APIs can directly transfer values for graph building. |
#include <es_tensor_like.h> |
||
|
Function |
Creates a graph builder instance. |
#include <ge/es_funcs.h> |
|
|
Releases graph builder resources. |
|||
|
Creates an input on a graph. |
|||
|
Creates a data input on a graph. |
|||
|
Sets the data type of a tensor. If no data type is specified, the default value float is used. |
|||
|
Sets the memory format of a tensor. If no format is set, the default value ND is used. |
|||
|
Sets the shape of a tensor. If no shape is set, the default value [] is used, that is, a scalar. |
|||
|
Sets the symbolic expression of the tensor shape. If it is not set, there is no symbolic information by default. |
|||
|
Creates a Const node of the int64 type. |
|||
|
Creates a Const node of the int32 type. |
|||
|
Creates a Const node of the uint64 type. |
|||
|
Creates a Const node of the uint32 type. |
|||
|
Creates a Const node of the float type. |
|||
|
Creates a vector constant of the int64 type. |
|||
|
Creates a vector constant of the int32 type. |
|||
|
Creates a vector constant of the uint64 type. |
|||
|
Creates a vector constant of the uint32 type. |
|||
|
Creates a vector constant of the float type. |
|||
|
Creates a scalar constant of the int64 type. |
|||
|
Creates a scalar constant of the int32 type. |
|||
|
Creates a scalar constant of the uint64 type. |
|||
|
Creates a scalar constant of the uint32 type. |
|||
|
Creates a scalar constant of the float type. |
|||
|
Creates a variable node. |
|||
|
Sets the output of a graph. |
|||
|
Returns the pointer to the ge::Graph instance. The ownership is transferred to the caller. |
|||
|
Returns the snapshot of the EsCGraphBuilder instance. The ownership is not transferred. |
|||
|
Returns the snapshot of the ge::GNode instance. |
|||
|
Connects control edges. |
|||
|
Creates an EsCTensor by a C user. |
|||
|
Creates an EsCTensor by a C user using a binary file. |
|||
|
Sets the int64 attribute of a graph. |
|||
|
Sets the string attribute of a graph. |
|||
|
Sets the Boolean attribute of a graph. |
|||
|
Sets the int64 attribute of a tensor. |
|||
|
Sets the string attribute of a tensor. |
|||
|
Sets the Boolean attribute of a tensor. |
|||
|
Sets the int64 attribute of a node. |
|||
|
Sets the string attribute of a node. |
|||
|
Sets the Boolean attribute of a node. |
Data Structures and APIs
|
Category |
Data Structure/API |
Function |
Header File/Library File |
|---|---|---|---|
|
Class and structure |
Supports the external allocator registered by users. |
Header file: #include <ge/ge_allocator.h> |
|
|
ArgDescInfo class. This class describes the address information specified by Args, a kernel input parameter. It semantically expresses Args-specified addresses and specifies the usage and related information about each address. |
Header file: #include <graph/arg_desc_info.h> |
||
|
ArgsFormat serialization information. |
Header file: #include <graph/arg_desc_info.h> |
||
|
Stores attribute values. |
|
||
|
Provides brief information about the graph build result. |
|
||
|
Inherited from InferShapeContext, CtInferShapeContext is used for shape inference during compilation and provides APIs for compilation. |
Header file: #include <ct_infer_shape_context.h> |
||
|
Inherited from InferShapeRangeContext, CtInferShapeRangeContext is used for ShapeRange inference during compilation and provides APIs for compilation. |
Header file: #include <ct_infer_shape_range_context.h> |
||
|
Obtains the custom pass context object. |
|
||
|
Decomposes the pass class. |
Header file: #include <ge/fusion/pass/decompose_pass.h> |
||
|
Details the external weights to be persisted into a disk. |
|
||
|
Stores feature memory information. |
|
||
|
Fusion pass. |
Header file: #include <ge/fusion/pass/fusion_base_pass.h> |
||
|
Fusion pass registration class. |
Header file: #include <ge/fusion/pass/fusion_pass_reg.h> |
||
|
Provides utilities for GE graph modification, such as shape inference, node support verification, and graph optimization. |
|
||
|
Constructs node data of a graph. |
|
||
|
Constructs graph-related classes. |
|
||
|
Stores the cached data of graphs. |
|
||
|
Obtains the inference context object and sets the shape and data type of the object for resource operators. |
Header file: #include <graph/inference_context.h> |
||
|
Registers the operator InferFormat function. This API is referenced by other header files and is not directly called by operator developers. |
Header file: #include <graph/operator_factory.h> |
||
|
Registers the operator infershape function. This API is referenced by other header files and is not directly called by operator developers. |
Header file: #include <graph/operator_factory.h> |
||
|
Registers the operator InferValueRangeFuncRegister function. This API is referenced by other header files and is not directly called by operator developers. |
Header file: #include <graph/operator_factory.h> |
||
|
Input tensor information. |
Header file: #include <ge/ge_api_types.h> |
||
|
Provides APIs for creating and managing tasks delivered to devices. The APIs allow developers to set or obtain the launch information about the tasks to be delivered to devices. |
Header file: #include <graph/kernel_launch_info.h> |
||
|
Allocates information to logical streams. |
|
||
|
A matching result on the graph by means of PatternMatcher. The result contains the matching node. |
|
||
|
Serialized model data in the memory buffer. |
|
||
|
Operator class. |
|
||
|
Registers an operator prototype. This API is referenced by other header files. Therefore, it is not directly called by operator developers. |
Header file: #include <graph/operator_factory.h> |
||
|
An internal associated API, which is referenced by other header files and is not directly called by operator developers. |
Header file: #include <graph/operator_factory.h> |
||
|
The APIs provided by the OpLibRegister class are internal associated APIs. Currently, the class provides the registration function for the custom operator dynamic library so that the custom operator project framework can register specified initialization functions. You do not need to pay attention to these APIs. |
Header file: #include <register/op_lib_register.h> |
||
|
Output tensor information. |
Header file: #include <ge/ge_api_types.h> |
||
|
Receives fusion pass registration information and registers it with the global singleton. |
Header file: #include <ge/fusion/pass/fusion_pass_reg.h> |
||
|
Defines a template for graph structure matching. It receives a graph and uses it to describe the graph structure to be matched. |
|
||
|
Pattern fusion class. |
Header file: #include <ge/fusion/pass/pattern_fusion_pass.h> |
||
|
Tool class for subgraph matching. It receives pattern definition and a graph to be matched. It uses the pattern to perform graph matching, provides the MatchNext API to return matching results one by one. |
|
||
|
A class used to configure the PatternMatcher behavior. |
|
||
|
An auxiliary class used to construct PatternMatcherConfig. |
|
||
|
Sets and obtains the shape and data type of an object. |
Header file: #include <graph/inference_context.h> |
||
|
Stream allocation summary. |
|
||
|
Context object for the logical stream allocation pass. |
|
||
|
A tool class for graph modification. It receives a range on a graph and a replacement graph, and uses the replacement graph to replace the nodes in the given range on the graph. |
|
||
|
Describes an input tensor of a subgraph. |
Header file: #include <ge/fusion/subgraph_boundary.h> |
||
|
Describes an output tensor of a subgraph. |
Header file: #include <ge/fusion/subgraph_boundary.h> |
||
|
Defines a subgraph boundary. |
Header file: #include <ge/fusion/subgraph_boundary.h> |
||
|
Registers the operator verifyFunc function. This API is referenced by other header files and is not directly called by operator developers. |
Header file: #include <graph/operator_factory.h> |
||
|
Function |
A template function. It accepts a template parameter T and converts it to the AscendString type. Converts strings of different types to those of the AscendString type. |
Header file: #include <graph/operator_reg.h> |
|
|
Defines a template function ConvertToListAscendString to convert strings of different types to those of the AscendString type. |
Header file: #include <graph/operator_reg.h> |
||
|
Macro |
Encapsulated macro of common functions, facilitating the development of the InferShape function. This function sets the output shape based on the shapes of two inputs. This macro sets shape only, and does not set dtype. |
Header file: #include <graph/operator_reg.h> |
|
|
Registers the InferShape function of an operator. |
Header file: #include <graph/operator_reg.h> |
||
|
Encapsulated macro of common functions, facilitating the development of the InferShape function. This API sets the output shape and dtype based on the input shape and dtype. |
Header file: #include <graph/operator_reg.h> |
||
|
Encapsulates the Common_InferShape function of an operator. |
Header file: #include <graph/operator_reg.h> |
||
|
Encapsulates the inferFormat function of an operator. |
Header file: #include <graph/operator_reg.h> |
||
|
Encapsulates the InferShape function of an operator. |
Header file: #include <graph/operator_reg.h> |
||
|
Encapsulates the Verify function of an operator. |
Header file: #include <graph/operator_reg.h> |
||
|
Registers the InferFormat implementation of an operator. |
Header file: #include <graph/operator_reg.h> |
||
|
Registers the InferShape function of an operator. |
Header file: #include <graph/operator_reg.h> |
||
|
Registers the function of a custom fusion pass. |
|
||
|
Graph modification function in the 1-to-N scenario. |
|
||
|
Registers the function of a custom pass. |
|
||
|
Registers the Verify function of an operator. |
Header file: #include <graph/operator_reg.h> |
||
|
Prototype definition API. |
Header file: #include <graph/operator_reg.h> |
||
|
Prototype definition derivative APIs. |
Header file: #include <graph/operator_reg.h> |
||
|
Interface C |
Obtains the path of the custom operator library. |
Header file: #include <register/register_base.h> |
|
|
Applies only to the scenario where the graph is executed asynchronously. The specified session is used to bind the graph with the specified value of graph ID to the corresponding stream. |
|
||
|
Runs the graph of a specified ID using the specified session instance and returns the execution result. This API is asynchronous. |
|||
|
Obtains all nodes of the root graph and subgraphs. |
|
||
|
Obtains the IDs of the auxiliary secondary logical streams of the root graph and subgraphs. |
|||
|
Obtains the actual number of physical streams of the communication secondary stream corresponding to the root graph and subgraphs. |
|||
|
Obtains the logical stream IDs of the root graph and subgraphs. |
|||
|
Obtains the actual number of physical streams of the root graph and subgraphs. |
|||
|
Obtains the logical stream information strings of the root graph and subgraphs. |
|||
|
Obtains the stream graphs of the root graph and subgraphs. |
|||
|
Obtains the user stream labels of the root graph and subgraphs. |
|||
|
Specifies whether the root graph and subgraphs are allocated by the user-registered stream allocation pass. |
|||
|
Obtains the prototype definition of a registered IR operator. |
|
||
|
Enumerations |
Type of an Args address. |
Header file: #include <graph/arg_desc_info.h> |
|
|
Hidden input address type of ArgDescInfo. |
|||
|
Format of dump files. |
Header file: #include <graph/graph.h> |
||
|
- |
Header file: #include <ge/ge_api_types.h> |
||
|
Configuration file of the Profiling data type. |
This feature is not supported by the |
||
|
Profiling AI Core metrics. |
|||
|
Configuration parameters |
- |
Header file: #include <ge/ge_api_types.h> |
|
|
- |
Header file: #include <ge/ge_api_types.h> |
||
|
- |
Header file: #include <ge/ge_api_types.h> |
||
|
- |
Header file: #include <ge/ge_api_types.h> This feature is not supported by the |
||
|
Attribute name that can be set for the SetAttr API. |
Header file: #include <ge/ge_api_types.h> |
||
|
Error codes |
GE error codes and macro information. |
|