INPUT
Function Prototype
INPUT (x, t)
Function Description
Registers the input information of an operator.
After the operator 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 x and the data type supported by the operator input is TensorType{DT_FLOAT}, call the INPUT(x, TensorType{DT_FLOAT}) API. After the operator input is successfully registered, the following APIs are automatically generated:
static const string name_in_x(); // Returns the input name, that is, x. _THIS_TYPE& set_input_x(Operator& v, const string& srcName);// Specifies the link between input x and output srcName of the operator object v. The operator object itself is returned. _THIS_TYPE& set_input_x(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_x(); // Returns the description of input x. graphStatus update_input_desc_x(const TensorDesc& tensorDesc);// Sets the description of input x, including Shape, DataType, and Format. graphStatus indicates the uint32_t type. If a non-zero value is returned, an error occurs.
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} For details about class TensorType, see Description of Class TensorType. |
Return Value
None
Exception Handling
None
Restriction
For an operator, the registered input name must be unique.
Description of Class TensorType
Class TensorType defines the data types supported by the input or output. The following APIs are provided:
- TensorType(DataType dt): Specifies that only one data type is supported.
- TensorType(std::initializer_list<DataType> types): Specifies that multiple data types are supported.
- static TensorType ALL(): Specifies that all data types are supported.
- static TensorType FLOAT(): Specifies that the DT_FLOAT and DT_FLOAT16 data types are supported.
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