Overview

Both the V2 APIs described in this section and V1 APIs described in Session can be used to load, build, and run graphs. However, these two sets of APIs cannot be used together. It is recommended that the V1 APIs be used. V1 APIs will be deprecated gradually.

  • Originally, Session contains both GE and DataFlow APIs. GE-related APIs are now grouped as the GeSession class in the ge_api_v2.h header file for clearer module division.
  • In addition, certain optimizations are made to solve the problem that the original APIs use similar names for different functions. The original compilation APIs include CompileGraph and BuildGraph, and the original execution APIs include ExecuteGraphWithStreamAsync and RunGraphWithStreamAsync. These APIs have clear distinctions in functions, but their names may be confused and cannot be used together. For example, BuildGraph cannot be used together with ExecuteGraphWithStreamAsync, and CompileGraph cannot be called together with RunGraph and RunGraphAsync.

In V2, APIs are simplified and unified as follows:

  • Only one compilation API, CompileGraph, is reserved.
  • Only one asynchronous execution API with streams, RunGraphWithStreamAsync, is reserved.
  • The inputs and outputs parameters for the execution API use the gert::Tensor type, which provides better performance.

This adjustment aims to improve the clarity and consistency of APIs and prevent function exceptions caused by incorrect API usage.