SetInputAttr
Description
Sets the attribute value of the operator input tensor.
An operator may have multiple attributes. Once an attribute value is set, the data type of the attribute is fixed. The following data types are supported:
- Integer: int64_t, uint32_t, or int32_t
Take 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);
The above lines set the attribute value.
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.
- List of integers: std::vector<int64_t>, std::vector<int32_t>, std::vector<uint32_t>, or std::initializer_list<int64_t>&&
- Floating point number: float32_t
- List of floating-point numbers: std::vector<float32_t>
- String: string
- Bool: bool
- List of bools: std::vector<bool>
Prototype
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)
Parameters
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 type float. |
attr_value |
Input |
Attribute value of type std::vector<float>. |
attr_value |
Input |
Attribute value of type bool. |
attr_value |
Input |
Attribute value of type std::vector<bool>. |
attr_value |
Input |
Attribute value of type string. |
attr_value |
Input |
Attribute value of type std::vector<string>. |
Returns
Operator object
Exception Handling
None
Restrictions
None