To
Function
After this parameter is set, the data type of aclScalar or aclScalarList is cast to the data type specified by this parameter when a single-operator API (aclnnxxx) is called.
The specified data type can be passed in either of the following ways:
- Pass datatype directly.
- Pass an input name which indicates that the data type is the same as the input datatype.
This API is supported only in the following scenarios:
- Develop a single-operator calling application by executing single-operator APIs.
- Calling a single-operator API (aclnnxxx) indirectly: single-operator calling in the PyTorch framework.
Prototype
1 2 | OpParamDef &To(const ge::DataType type) OpParamDef &To(const char *name) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
type |
Input |
Data type. |
name |
Input |
Operator input name, indicating that the specified data type is the same as the input data type. |
Returns
OpParamDef operator definition. For details, see OpParamDef.
Constraints
None
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | this->Input("x") .ParamType(REQUIRED) .DataType({ge::DT_FLOAT, ge::DT_FLOAT}) .Format({ge::FORMAT_ND, ge::FORMAT_ND}) .ScalarList() .To(ge::DT_FLOAT); this->Input("x1") .ParamType(REQUIRED) .DataType({ge::DT_FLOAT, ge::DT_FLOAT}) .Format({ge::FORMAT_ND, ge::FORMAT_ND}); this->Input("x2") .ParamType(REQUIRED) .DataType({ge::DT_FLOAT, ge::DT_FLOAT}) .Format({ge::FORMAT_ND, ge::FORMAT_ND}) .ScalarList() .To("x1"); |
Parent topic: OpParamDef