REQUIRED_ATTR
Function Prototype
REQUIRED_ATTR (x, type)
Function Description
Registers an operator attribute. The default value must be specified.
After the operator attributes are successfully registered, three external APIs (for obtaining the attribute name, obtaining the attribute value, and setting the attribute value, respectively) are automatically generated.
For example, register the attribute mode of the int64_t type by calling the REQUIRED_ATTR (mode, Int) API. After the operator attribute is successfully registered, the following APIs are automatically generated:
static const string name_attr_mode(); // Returns the attribute name, that is, mode. OpInt get_attr_mode() const; // Returns the value of the mode attribute. OpInt indicates int64_t. _THIS_TYPE& set_attr_mode(const OpInt& v); // Sets the value of the mode attribute. A this object is returned.
Parameter Description
Parameter |
Input/Output |
Type |
Description |
---|---|---|---|
x |
Input |
- |
Macro parameter, attribute name of the operator |
type |
Input |
- |
The following attribute types are supported:
|
Return Value
None
Exception Handling
None
Restriction
For an operator, the registered attribute name must be unique.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot