Sets the attribute value of the operator input tensor.
An operator may have multiple attributes. Once the value of an attribute is initially set, the data type of the attribute is fixed. The following data types are supported:
Integer: int64_t, uint32_t, and int32_t
The following uses int64_t as an example:
SetInputAttr(const char_t *dst_name, const char_t *name, int64_t attr_value); SetInputAttr(const int32_t index, const char_t *name, int64_t attr_value);
Set attribute values:
GetInputAttr(const int32_t index, const char_t *name, int64_t &attr_value) const; GetInputAttr(const char_t *dst_name, const char_t *name, int64_t &attr_value) const;
The above lines obtain the attribute value, during which you need to ensure that the integers are not truncated. You also need to check this when int32_t and uint32_t are used together.
Integer list: std::vector[/topic/body/section/ul/li/p/b/int64_t {""}) (int64_t], std::vector[/topic/body/section/ul/li/p/b/int32_t {""}) (int32_t], std::vector[/topic/body/section/ul/li/p/b/uint32_t {""}) (uint32_t], or std::initializer_list[/topic/body/section/ul/li/p/b/int64_t {""}) && (int64_t]
Floating-point number: float32_t
Floating-point number list: std::vector[/topic/body/section/ul/li/p/b/float32_t {""}) (float32_t]
String
bool
Bool list: std::vector<bool>
Operator &SetInputAttr(const int32_t index, const char_t *name, const char_t *attr_value); Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const char_t *attr_value); Operator &SetInputAttr(const int32_t index, const char_t *name, const AscendString &attr_value); Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const AscendString &attr_value); Operator &SetInputAttr(const int32_t index, const char_t *name, int64_t attr_value); Operator &SetInputAttr(const char_t *dst_name, const char_t *name, int64_t attr_value); Operator &SetInputAttr(const int32_t index, const char_t *name, int32_t attr_value); Operator &SetInputAttr(const char_t *dst_name, const char_t *name, int32_t attr_value); Operator &SetInputAttr(const int32_t index, const char_t *name, uint32_t attr_value); Operator &SetInputAttr(const char_t *dst_name, const char_t *name, uint32_t attr_value); Operator &SetInputAttr(const int32_t index, const char_t *name, bool attr_value); Operator &SetInputAttr(const char_t *dst_name, const char_t *name, bool attr_value); Operator &SetInputAttr(const int32_t index, const char_t *name, float32_t attr_value); Operator &SetInputAttr(const char_t *dst_name, const char_t *name, float32_t attr_value); Operator &SetInputAttr(const int32_t index, const char_t *name, const std::vector<AscendString> &attr_value); Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const std::vector<AscendString> &attr_value); Operator &SetInputAttr(const int32_t index, const char_t *name, const std::vector<int64_t> &attr_value); Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const std::vector<int64_t> &attr_value); Operator &SetInputAttr(const int32_t index, const char_t *name, const std::vector<int32_t> &attr_value); Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const std::vector<int32_t> &attr_value); Operator &SetInputAttr(const int32_t index, const char_t *name, const std::vector<uint32_t> &attr_value); Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const std::vector<uint32_t> &attr_value); Operator &SetInputAttr(const int32_t index, const char_t *name, const std::vector<bool> &attr_value); Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const std::vector<bool> &attr_value); Operator &SetInputAttr(const int32_t index, const char_t *name, const std::vector<float32_t> &attr_value); Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const std::vector<float32_t> &attr_value);
| Parameter | Input/Output | Description |
|---|---|---|
| name | Input | Attribute name. |
| index | Input | Input index. |
| dst_name | Input | Input edge name. |
| attr_value | Input | Attribute value of type int64_t. |
| attr_value | Input | Attribute value of type int32_t. |
| attr_value | Input | Attribute value of type uint32_t. |
| attr_value | Input | Attribute value of type vector<int64_t>. |
| attr_value | Input | Attribute value of type vector<int32_t>. |
| attr_value | Input | Attribute value of type vector<uint32_t>. |
| attr_value | Input | Attribute value of the floating-point type. |
| attr_value | Input | Attribute value of the floating-point list type. |
| attr_value | Input | Attribute value of the bool type. |
| attr_value | Input | Attribute value of the bool list type. |
| attr_value | Input | Attribute value of the string type. |
| attr_value | Input | Attribute value of the string list type. |