te.lang.cce.cast_to(data, dtype, f1628IntegerFlag=False)
Converts a data type, specifically, converts a data type into dtype.
This API is defined in common.py.
The following data type conversions are supported:
Source Data Type |
Destination Data Type |
---|---|
float32 |
float16 |
float32 |
int8 |
float32 |
uint8 |
float16 |
float32 |
float16 |
int8 |
float16 |
uint8 |
float16 |
int32 |
int8 |
float16 |
int8 |
uint8 |
int32 |
float16 |
int32 |
int8 |
int32 |
uint8 |
Parameter Description
- data: input tensor, tvm.tensor type
- dtype: destination data type, string type
- f1628IntegerFlag: The default value is False. If the decimal part of the data before conversion is 0, set f1628IntegerFlag to True. If the decimal part of the data before conversion is not 0, set f1628IntegerFlag to False.
Return Value
res_tensor: data after conversion, tvm.tensor type
Calling Example
shape = (1024,1024) input_dtype = "float16" data = tvm.placeholder(shape, name="data", dtype=input_dtype) res = te.lang.cce.cast_to(data,"float32")
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