GetAttr
Description
Obtains the attribute value based on the attribute name.
Prototype
APIs using strings will be deprecated in later versions. Use APIs supporting non-string data instead.
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 |
Returned attribute value of type int64_t. |
attr_value |
Output |
Returned attribute value of type int32_t. |
attr_value |
Output |
Returned attribute value of type uint32_t. |
attr_value |
Output |
Returned attribute value of type std::vector<int64_t>. |
attr_value |
Output |
Returned attribute value of type std::vector<int32_t>. |
attr_value |
Output |
Returned attribute value of type std::vector<uint32_t>. |
attr_value |
Output |
Returned attribute value of type float. |
attr_value |
Output |
Returned attribute value of type std::vector<float>. |
attr_value |
Output |
Returned attribute value of type AttrValue. |
attr_value |
Output |
Returned attribute value of type bool. |
attr_value |
Output |
Returned attribute value of type std::vector<bool>. |
attr_value |
Output |
Returned attribute value of type string. |
attr_value |
Output |
Returned attribute value of type std::vector<string>. |
attr_value |
Output |
Returned attribute value of type Tensor. |
attr_value |
Output |
Returned attribute value of type std::vector<Tensor>. |
attr_value |
Output |
Returned attribute value of type OpBytes, or std::vector<uint8_t>. |
attr_value |
Output |
Returned attribute value of the quantized data type. |
attr_value |
Output |
Returned attribute value of type std::vector<std::vector<int64_t>>. |
attr_value |
Output |
Returned attribute value of type std::vector<ge::DataType>. |
attr_value |
Output |
Returned attribute value of type DataType. |
attr_value |
Output |
Returned attribute value of type vector<ge::NamedAttrs>. |
attr_value |
Output |
Returned attribute value of type NamedAttrs. |
Returns
graphStatus type. GRAPH_SUCCESS if the corresponding name is found; otherwise, GRAPH_FAILED.
Exception Handling
None
Restrictions
None