build_and_reset

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Function Usage

Builds a graph.

Prototype

1
build_and_reset(outputs: Optional[List[TensorHolder]] = None) -> Graph

Parameters

Parameter

Input/Output

Description

outputs

Input

(Optional) List of tensor holders to be set as the graph output. If provided, all outputs are automatically set before the graph is built. The output index starts from 0 and is allocated in sequence. If the value is None, the previously set output is used to build a graph.

Returns

(Graph) Constructed graph object.

Restrictions

  • After build_and_reset() is called, the builder enters the built state and cannot be used to create new tensors.
  • A new GraphBuilder needs to be created to build another graph.
  • If the output is not a TensorHolder object list, TypeError is thrown.
  • If the build fails, RuntimeError is thrown.