SetAttr

Applicability

Product

Supported or Not

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Header File/Library File

  • Header file: #include <graph/graph.h>
  • Library file: libgraph.so

Function Usage

Sets the attributes of a graph. This API is a generic API and its attribute type is attr_value.

Prototype

1
graphStatus SetAttr(const AscendString &name, const AttrValue &attr_value)

Parameters

Parameter

Input/Output

Description

name

Input

Attribute name.

attr_value

Input

Attribute value.

Returns

Parameter

Type

Description

-

graphStatus

GRAPH_SUCCESS(0): success.

Other values: failure.

Constraints

None

Examples

1
2
3
4
AttrValue av;
av.SetAttrValue(static_cast<int64_t>(100));
Graph graph("test");
graph.SetAttr("int_attr", av);