OPTIONAL_INPUT
Function Prototype
OPTIONAL_INPUT(x, t)
Function Description
Registers the optional input information of an operator.
After the optional input information is successfully registered, APIs (for obtaining the operator input name and setting the operator input description) are generated automatically.
For example, if the operator input is b and the data type supported by the operator input is TensorType{DT_FLOAT}, call the OPTIONAL_INPUT(b, TensorType{DT_FLOAT}) API. After the operator input is successfully registered, the following APIs are automatically generated:
static const string name_in_b(); // Return the input name, that is, b. _THIS_TYPE& set_input_b(Operator& v, const string& srcName);// Specifies the link between input b and output srcName of the operator object v. The operator object itself is returned. _THIS_TYPE& set_input_b(Operator& v); // Specifies the link between input x and output 0 of the operator object v. The operator object is returned. TensorDesc get_input_desc_b(); // Returns the description of input b. graphStatus update_input_desc_b(const TensorDesc& tensorDesc);// Sets the description of input b, including Shape, DataType, and Format.
Parameter Description
Parameter |
Input/Output |
Type |
Description |
---|---|---|---|
x |
Input |
- |
Macro parameter, input name of the operator |
t |
Input |
- |
Data type supported by the operator input. One or more data types defined by TensorType are supported. Separate data types with commas (,). For example: TensorType{DT_FLOAT} TensorType({DT_FLOAT, DT_INT8} |
Return Value
None
Exception Handling
None
Restriction
For an operator, the registered input 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