SetOutput

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

Header File/Library File

  • Header file: #include <ge/es_graph_builder.h>
  • Library files: libeager_style_graph_builder_base.so and libeager_style_graph_builder_base_static.a

Function Usage

Sets the output node of a graph.

Prototype

1
static int64_t SetOutput(const EsTensorHolder &tensor, int64_t index);

Parameters

Parameter

Input/Output

Description

tensor

Input

Output tensor holder.

index

Input

Output index, starting from 0.

Returns

Parameter

Type

Description

-

int64_t

Operation result. If the operation is successful, 0 is returned. If the operation fails, a non-zero value is returned.

Restrictions

None

Example

1
2
3
4
5
6
7
8
//1. Create a graph builder (EsGraphBuilder).
EsGraphBuilder builder("graph_name");
// 2. Add two input nodes.
EsTensorHolder [data0, data1] = builder.CreateInputs<2>();
// 3. Add an intermediate node. In C++, common operators such as addition, subtraction, multiplication, and division have been overloaded for direct use.
EsTensorHolder add = data0 + data1;
// 4. Set the graph output. add is the 0th output tensor.
builder.SetOutput(add, 0);