bundle_build_model

Applicable Products

All processors

Function Usage

Builds a group of input graphs into an offline model adapted to the AI processor and saves the model to the memory buffer. This API applies to weight update scenarios.

Prototype

1
bundle_build_model(graph_with_options: List[GraphWithOptions]) -> ModelBuffer

Parameters

Parameter

Input/Output

Description

graph_with_options

Input

A group of graphs to be built and build parameters. The input parameter is a structure, including:

class GraphWithOptions:
    graph: Graph
    build_options: Dict[str, str] = field(default_factory=dict)

A group of graphs include the weight initialization graph, weight update graph, and inference graph. Only the inference graph supports the following options parameter.

Pass the options parameter to set the build configuration for offline model generation. For details about the supported parameters, see aclgrphBuildModel Configuration Parameters.

Returns

(ModelBuffer) Buffer of the generated offline model

Restrictions

  • If graph_with_options is not of the List[GraphWithOptions] type, TypeError is thrown.
  • If the build fails, RuntimeError is thrown.