To
Function Usage
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.
- Indirectly call a single-operator API (aclnnxxx): single-operator calling in the PyTorch framework.
Prototype
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
Example
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