Converts the input tensor to the specified dtype.
Each operator has calls. First, [object Object] is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, [object Object] is called to perform computation.
Parameters
[object Object]- [object Object]Atlas training products[object Object] and [object Object]Atlas inference products[object Object]: The data type cannot be BFLOAT16 or INT4.
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: The data type cannot be COMPLEX32, HIFLOAT8, FLOAT8_E5M2, FLOAT8_E4M3FN, FLOAT4_E2M1, FLOAT4_E1M2, or INT4.
Returns
[object Object]: status code. For details, see .The first-phase API implements input parameter validation. The following error codes may be returned.
[object Object]
Deterministic computation:
[object Object]defaults to a deterministic implementation.
For conversion from floating-point to integer: If the input data contains
[object Object], it is converted to[object Object].For input data types of BOOL, COMPLEX32, COMPLEX64, COMPLEX128, FLOAT4_E2M1, or FLOAT4_E1M2: Non-contiguous inputs are not supported.
[object Object]Atlas inference products[object Object], [object Object]Atlas training products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]:
- For conversion from INT32 to INT8: Zero precision error is guaranteed only for input data within the range of (-2048, 1920).
- For conversion from FLOAT64/COMPLEX64/COMPLEX128 to UINT8: Zero precision error is guaranteed only for non-negative input data.
[object Object]Atlas inference products[object Object]:
For conversion from FLOAT32 to INT64 or FLOAT32 to UINT8: Zero precision error is guaranteed only for input data within the range of (-2147483648, 2147483583).
For conversion from INT64 to FLOAT32: Zero precision error is guaranteed only for input data within the range of (-2147483648, 2147483647).
Ascend 950PR/Ascend 950DT:
For the scenario where the output type is INT4: The last axis of the input shape cannot be an odd number, and the input cannot be discontinuous.
For the input and output types involving COMPLEX32, FLOAT4_E2M1, FLOAT4_E1M2, HIFLOAT8, FLOAT8_E5M2, FLOAT8_E4M3FN and INT4, only the conversion paths in the following table are supported.
[object Object]undefined
The following example is for reference only. For details, see .