Overview

The offline_compile module is used to compile offline graphs.

The following is an example of offline graph compilation:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from ge.graph import Graph
from ge.offline_compile import build_initialize, build_finalize, build_model, save_model

# Create a graph.
graph = Graph("test_graph")
# Initialize model build.
build_initialize({"ge.socVersion": "Ascend910B1"})
# Build the model.
model = build_model(graph, {"input_format": "ND"})
# Save the model.
save_model("sample", model)
# Release model build resources.
build_finalize()