SetOutputAttr
Applicability
Product |
Supported or Not |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Header File/Library File
- Header file: #include <graph/operator.h>
- Library file: libgraph.so
Function Usage
Sets the attribute value of the operator output tensor.
An operator may have multiple attributes. Once the value of an attribute is set, the data type of the attribute is fixed. The following data types are supported:
- Integer: int64_t, uint32_t, and int32_t
Take int64_t as an example.
SetOutputAttr(const char_t *dst_name, const char_t *name, int64_t attr_value);
SetOutputAttr(const int32_t index, const char_t *name, int64_t attr_value);
The above lines set the attribute value.
GetOutputAttr(const int32_t index, const char_t *name, int64_t &attr_value) const;
GetOutputAttr(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 clipped. You also need to check this when int32_t and uint32_t are used together.
- Integer list: std::vector<int64_t>, std::vector<int32_t>, std::vector<uint32_t>, or std::initializer_list<int64_t>&&
- Floating-point number: float32_t
- Floating-point number list: std::vector<float32_t>
- String: string
- Bool: bool
- Bool list: std::vector<bool>
Prototype
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 | Operator &SetOutputAttr(const int32_t index, const char_t *name, const char_t *attr_value) Operator &SetOutputAttr(const char_t *dst_name, const char_t *name, const char_t *attr_value) Operator &SetOutputAttr(const int32_t index, const char_t *name, const AscendString &attr_value) Operator &SetOutputAttr(const char_t *dst_name, const char_t *name, const AscendString &attr_value) Operator &SetOutputAttr(const int32_t index, const char_t *name, int64_t attr_value) Operator &SetOutputAttr(const char_t *dst_name, const char_t *name, int64_t attr_value) Operator &SetOutputAttr(const int32_t index, const char_t *name, int32_t attr_value) Operator &SetOutputAttr(const char_t *dst_name, const char_t *name, int32_t attr_value) Operator &SetOutputAttr(const int32_t index, const char_t *name, uint32_t attr_value) Operator &SetOutputAttr(const char_t *dst_name, const char_t *name, uint32_t attr_value) Operator &SetOutputAttr(const int32_t index, const char_t *name, bool attr_value) Operator &SetOutputAttr(const char_t *dst_name, const char_t *name, bool attr_value) Operator &SetOutputAttr(const int32_t index, const char_t *name, float32_t attr_value) Operator &SetOutputAttr(const char_t *dst_name, const char_t *name, float32_t attr_value) Operator &SetOutputAttr(const int32_t index, const char_t *name, const std::vector<AscendString> &attr_value) Operator &SetOutputAttr(const char_t *dst_name, const char_t *name, const std::vector<AscendString> &attr_value) Operator &SetOutputAttr(const int32_t index, const char_t *name, const std::vector<int64_t> &attr_value) Operator &SetOutputAttr(const char_t *dst_name, const char_t *name, const std::vector<int64_t> &attr_value) Operator &SetOutputAttr(const int32_t index, const char_t *name, const std::vector<int32_t> &attr_value) Operator &SetOutputAttr(const char_t *dst_name, const char_t *name, const std::vector<int32_t> &attr_value) Operator &SetOutputAttr(const int32_t index, const char_t *name, const std::vector<uint32_t> &attr_value) Operator &SetOutputAttr(const char_t *dst_name, const char_t *name, const std::vector<uint32_t> &attr_value) Operator &SetOutputAttr(const int32_t index, const char_t *name, const std::vector<bool> &attr_value) Operator &SetOutputAttr(const char_t *dst_name, const char_t *name, const std::vector<bool> &attr_value) Operator &SetOutputAttr(const int32_t index, const char_t *name, const std::vector<float32_t> &attr_value) Operator &SetOutputAttr(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 |
Output index. |
dst_name |
Input |
Output 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. |
Returns
Object of class Operator.
Exception Handling
None
Constraints
None