Introduction
Overview
Ascend opens graph interface to developers to construct graphs and build graphs into offline models for offline reference on the Ascend AI Processor, freeing developers from the hassles associated with Caffe and TensorFlow framework adaption.
Graph Structure
TensorFlow and ONNX define networks in similar formats. A network model consists of tensors, nodes (or operators), and a graph.
- A tensor involves the tensor description and tensor data. Tensor description describes the name, dtype, shape, and format of the tensor.
- An operator involves its name, type, input, and attributes.
- A graph consists of the network name, operator list, and input and output operators.
Graph Construction Flow
Figure 1-1 shows the graph construction and building flow using Ascend graph interface calls.
The graph construction flow is briefly described as follows:
- Define a graph.
- Create a Graph object.
- Poll the weight information and define operator instances.
- Set the inputs of the graph.
- Set the outputs of the graph.
- Initialize the system and allocate resources.
- Build an offline model adapted to the Ascend AI Processor. The built-in operator library and custom operator library of the Tensor Boost Engine (TBE) are loaded during building.
- Serialize the offline model to a file.
- Release the resources.