目录

GetAttr

Function Description

Obtains the attribute value based on the attribute name.

Function Prototype

APIs taking string arguments will be deprecated in future releases. Use APIs taking non-string arguments 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 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.

Return Value

Type Description
graphStatus GRAPH_SUCCESS if the corresponding name is found; otherwise, GRAPH_FAILED.

Exception Handling

None

Restrictions

None