GetAttr
Applicability
Product |
Supported or Not |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Header File/Library File
- Header file: #include <graph/operator.h>
- Library file: libgraph.so
Function Usage
Obtains the attribute value based on the attribute name.
Prototype
APIs taking string arguments will be deprecated in future releases. Use APIs taking non-string arguments instead.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | graphStatus GetAttr(const std::string &name, int64_t &attr_value) const graphStatus GetAttr(const std::string &name, int32_t &attr_value) const graphStatus GetAttr(const std::string &name, uint32_t &attr_value) const graphStatus GetAttr(const std::string &name, std::vector<int64_t> &attr_value) const graphStatus GetAttr(const std::string &name, std::vector<int32_t> &attr_value) const graphStatus GetAttr(const std::string &name, std::vector<uint32_t> &attr_value) const graphStatus GetAttr(const std::string &name, float32_t &attr_value) const graphStatus GetAttr(const std::string &name, std::vector<float32_t> &attr_value) const graphStatus GetAttr(const std::string &name, AttrValue &attr_value) const graphStatus GetAttr(const std::string &name, std::string &attr_value) const graphStatus GetAttr(const std::string &name, std::vector<std::string> &attr_value) const graphStatus GetAttr(const std::string &name, bool &attr_value) const graphStatus GetAttr(const std::string &name, std::vector<bool> &attr_value) const graphStatus GetAttr(const std::string &name, Tensor &attr_value) const graphStatus GetAttr(const std::string &name, std::vector<Tensor> &attr_value) const graphStatus GetAttr(const std::string &name, OpBytes &attr_value) const graphStatus GetAttr(const std::string &name, std::vector<std::vector<int64_t>> &attr_value) const graphStatus GetAttr(const std::string &name, std::vector<ge::DataType> &attr_value) const graphStatus GetAttr(const std::string &name, ge::DataType &attr_value) const graphStatus GetAttr(const std::string &name, ge::NamedAttrs &attr_value) const graphStatus GetAttr(const std::string &name, std::vector<ge::NamedAttrs> &attr_value) const graphStatus GetAttr(const char_t *name, int64_t &attr_value) const graphStatus GetAttr(const char_t *name, int32_t &attr_value) const graphStatus GetAttr(const char_t *name, uint32_t &attr_value) const graphStatus GetAttr(const char_t *name, std::vector<int64_t> &attr_value) const graphStatus GetAttr(const char_t *name, std::vector<int32_t> &attr_value) const graphStatus GetAttr(const char_t *name, std::vector<uint32_t> &attr_value) const graphStatus GetAttr(const char_t *name, float32_t &attr_value) const graphStatus GetAttr(const char_t *name, std::vector<float32_t> &attr_value) const graphStatus GetAttr(const char_t *name, AttrValue &attr_value) const graphStatus GetAttr(const char_t *name, AscendString &attr_value) const graphStatus GetAttr(const char_t *name, std::vector<AscendString> &attr_values) const graphStatus GetAttr(const char_t *name, bool &attr_value) const graphStatus GetAttr(const char_t *name, std::vector<bool> &attr_value) const graphStatus GetAttr(const char_t *name, Tensor &attr_value) const graphStatus GetAttr(const char_t *name, std::vector<Tensor> &attr_value) const graphStatus GetAttr(const char_t *name, OpBytes &attr_value) const graphStatus GetAttr(const char_t *name, std::vector<std::vector<int64_t>> &attr_value) const graphStatus GetAttr(const char_t *name, std::vector<ge::DataType> &attr_value) const graphStatus GetAttr(const char_t *name, ge::DataType &attr_value) const graphStatus GetAttr(const char_t *name, ge::NamedAttrs &attr_value) const graphStatus GetAttr(const char_t *name, std::vector<ge::NamedAttrs> &attr_value) const |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
name |
Input |
Attribute name. |
attr_value |
Output |
Attribute value of type int64_t. |
attr_value |
Output |
Attribute value of type int32_t. |
attr_value |
Output |
Attribute value of type uint32_t. |
attr_value |
Output |
Attribute value of type vector<int64_t>. |
attr_value |
Output |
Attribute value of type vector<int32_t>. |
attr_value |
Output |
Attribute value of type vector<uint32_t>. |
attr_value |
Output |
Attribute value of the floating-point type. |
attr_value |
Output |
Attribute value of the floating-point list type. |
attr_value |
Output |
Attribute value of type AttrValue. |
attr_value |
Output |
Attribute value of the bool type. |
attr_value |
Output |
Attribute value of the bool list type. |
attr_value |
Output |
Attribute value of the string type. |
attr_value |
Output |
Attribute value of the string list type. |
attr_value |
Output |
Attribute value of type Tensor. |
attr_value |
Output |
Attribute value of the tensor list type. |
attr_value |
Output |
Attribute value of type OpBytes, or vector<uint8_t>. |
attr_value |
Output |
Attribute value of the quantized data type. |
attr_value |
Output |
Attribute value of type vector<vector<int64_t>>. |
attr_value |
Output |
Attribute value of type vector<ge::DataType>. |
attr_value |
Output |
Attribute value of type DataType. |
attr_value |
Output |
Attribute value of type vector<ge::NamedAttrs>. |
attr_value |
Output |
Attribute value of type NamedAttrs. |
Returns
graphStatus type. GRAPH_SUCCESS if the corresponding name is found; otherwise, GRAPH_FAILED.
Exception Handling
None
Constraints
None