API function:
Ascend 950PR/Ascend 950DT:
Converts the ND format (../common/Format.md) to the FRACTAL_NZ format (../common/Format.md) with the specified C0 size. C0 is the size of the last dimension of the FRACTAL_NZ format (../common/Format.md), and is determined by
[object Object].[object Object]Atlas A3 training products/Atlas A3 inference products[object Object] and [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]:
- Performs ND ←→ conversion. C0 is the size of the last dimension in the data format. The calculation method is as follows: C0 = 32B / ge::GetSizeByDataType(static_cast additionalDtype).
- Performs NCDHW ←→ and NCDHW ←→ conversion. C0 is closely related to the micro-architecture, and the value is equal to the cube unit size, for example, 16. C1 is obtained by splitting the C dimension based on C0: C1 = C/C0. If the result is not exactly divided, the last piece of data needs to be padded to C0. The calculation method is as follows: C0 = 32B / srcDataType (For example, FP16 is 2 bytes.)
Computing process:
[object Object]calculates the shape and actual data format of the destination tensor dstTensor based on the input tensor srcTensor, data type[object Object], and data format dstFormat of the destination tensor. Then,[object Object]is called to convert the srcTensor to the destination tensor dstTensor in the actual data format.
First, [object Object] is called to calculate the shape and actual data format of dstTensor. Then, the is called. For the two-phase API calls, the [object Object] API is called first to obtain the workspace size required for computation and the executor that contains the operator computation process, and then the [object Object] API is called to perform computation.
Parameters
[object Object]Ascend 950PR/Ascend 950DT:
- The superscript "1" in the data type column of the preceding table indicates that the data type or format is not supported by the corresponding series.
[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 superscript "2" in the data type column of the preceding table indicates that the data type or format is not supported by the corresponding series.
Returns:
[object Object]: status code. For details, see .The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]
Parameters
[object Object]Ascend 950PR/Ascend 950DT:
- The superscript "1" in the data type column of the preceding table indicates that the data type or format is not supported by the corresponding series.
[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 superscript "2" in the data type column of the preceding table indicates that the data type or format is not supported by the corresponding series.
Returns:
[object Object]: status code. For details, see .The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]Ascend 950PR/Ascend 950DT:
- The superscript "1" in the data type column in the preceding table indicates the interception type that is not supported by the series.
[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 superscript "2" in the data type column in the preceding table indicates the interception type that is not supported by the series.
Deterministic computing: The aclnnNpuFormatCast is implemented in deterministic mode by default.
The input and output support the following data type combinations:
[object Object][object Object]Parameters of the aclnnNpuFormatCastCalculateSizeAndFormat API:
[object Object]undefined
aclnnNpuFormatCastGetWorkspaceSize API:
[object Object]undefined
C0 calculation method:
[object Object]undefined
Currently, the following special scenarios are not supported:
- If the data type of
[object Object]is the same as that of[object Object]and is FLOAT16 or BFLOAT16, and the dimensions are represented as [k, n], the scenario where k is 1 is not supported. - After this API is called to convert the data format to Ascend affinity FRACTAL_NZ, any operation that can modify the tensor, such as contiguous, pad, and slice, is not supported.
- When any of the last two dimensions of the shape of
[object Object]is 1, any operation that can modify the tensor, including transpose, is not allowed after the data format is converted to Ascend affinity FRACTAL_NZ.
- If the data type of
Parameters of the aclnnNpuFormatCastCalculateSizeAndFormat API:
[object Object]undefined
aclnnNpuFormatCastGetWorkspaceSize API:
[object Object]undefined
C0 calculation method:
[object Object]undefined
Currently, the following special scenarios are not supported:
- After this API is called to convert the data format to Ascend affinity FRACTAL_NZ, any operation that can modify the tensor, such as contiguous, pad, and slice, is not supported.
- After the data format is converted to Ascend affinity FRACTAL_NZ, any operation that can modify the tensor, including transpose, is not allowed.
Ascend 950PR/Ascend 950DT: The following example is for reference only. For details, see .
[object Object][object Object]Atlas A3 training products/Atlas A3 inference products[object Object] and [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: The following example is for reference only. For details, see .
[object Object]