Updated on 2022-03-13 GMT+08:00

DYNAMIC_INPUT

Function Prototype

DYNAMIC_INPUT (x, t)

Function Description

Registers the dynamic input information of an operator.

After the dynamic input information is successfully registered, APIs (for creating dynamic input and setting the input description) are generated automatically.

For example, if the dynamic input is d and the data type supported by the operator input is TensorType{DT_FLOAT}, call the DYNAMIC_INPUT(d, TensorType{DT_FLOAT}) API. After the dynamic input is successfully registered, the following APIs are automatically generated:

_THIS_TYPE& create_dynamic_input_d(unsigned int num); // Creates dynamic input d, including a number of num inputs.
TensorDesc get_dynamic_input_desc_d(unsigned int index);// Returns description indexth of dynamic input d, including Shape, DataType, and Format.
graphStatus update_dynamic_input_desc_d(unsigned int index, const TensorDesc& tensorDesc);// Updates description indexth of dynamic input d.
_THIS_TYPE& set_dynamic_input_d(unsigned int dstIndex, Operator &v); // Specifies the link between input dstIndex of d and index 0 of the operator object v. The operator object itself is returned.
_THIS_TYPE& set_dynamic_input_d(unsigned int dstIndex, Operator &v, const string &srcName); // Specifies the link between input dstIndex of d and output srcName of the operator object v. The operator object itself is returned.

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.