[object Object]

[object Object][object Object]undefined
[object Object]
  • Operator function:
    • [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 C0 = 32B / ge::GetSizeByDataType(static_cast[object Object]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. Calculation method: C0 = 32B srcDataType (for example, FP16 is 2 bytes)
  • Calculation process: Based on the input tensor srcTensor, data type [object Object], and data format dstFormat of the target tensor, [object Object] is called to calculate the shape and actual data format of the converted target tensor dstTensor. The result is used to construct dstTensor. Then, [object Object] is called to convert srcTensor into dstTensor in the actual data format.
[object Object]

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.

  • [object Object]

  • [object Object]

  • [object Object]

[object Object]
  • Parameters

    • [object Object] (aclTensor*, computation input): input tensor, which is an aclTensor on the device. The input data can be contiguous or .

      • [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 can be ND, NZ, NCDHW, NDC1HWC0, or FRACTAL_Z_3D. The data type can be INT8, UINT8, FLOAT, FLOAT16, BF16, INT32, or UINT32. When the data format is ND, the supported shape dimensions are [2, 6].
    • [object Object] (int, computation input): data format of the output tensor.

      • [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 can be ND, NZ, NCDHW, NDC1HWC0, or FRACTAL_Z_3D.
    • [object Object] (int, computation input): basic data type used to infer the C0 size when the data format is converted to FRACTAL_NZ.

      • [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]: This parameter supports only the data type of srcTensor.
    • [object Object] (int64_t**, output parameter): pointer to the shape array of the output dstTensor. The memory to which the pointer points is allocated by this API and released by the caller.

    • [object Object] (uint64_t*, output parameter): pointer to the size of the shape array of the output dstTensor.

    • [object Object] (int*, output parameter): pointer to the actual data format of the output dstTensor.

      • [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 current output can be ACL_FORMAT_ND(2), ACL_FORMAT_FRACTAL_NZ(29), ACL_FORMAT_NCDHW(30), ACL_FORMAT_NDC1HWC0(32), or ACL_FRACTAL_Z_3D(33).
  • Returns:

    [object Object]: status code. For details, see .

    [object Object]
[object Object]
  • Parameters

    • [object Object] (aclTensor*, computation input): input tensor, which is an aclTensor on the device. The input data must be contiguous tensors.
      • [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 can be ND, NZ, NCDHW, NDC1HWC0, or FRACTAL_Z_3D. The data type can be INT8, UINT8, FLOAT, FLOAT16, BF16, INT32, or UINT32.
    • [object Object] (aclTensor*, computation input): converted target tensor, which is an aclTensor on the device. Only contiguous tensors are supported.
      • [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 can be ND, NZ, NCDHW, NDC1HWC0, or FRACTAL_Z_3D. The data type can be INT8, UINT8, FLOAT, FLOAT16, BF16, INT32, or UINT32.
    • [object Object] (uint64_t*, output): size of the workspace to be allocated on the device.
    • [object Object] (aclOpExecutor**, output): operator executor that contains the operator computation process.
  • Returns:

    [object Object]: status code. For details, see .

[object Object]
[object Object]
  • Parameters

    • [object Object] (void*, input): address of the workspace to be allocated on the device.
    • [object Object] (uint_64, input): size of the workspace to be allocated on the device, which is obtained by calling the first-phase API [object Object].
    • [object Object] (aclOpExecutor*, input): operator executor that contains the operator computation process.
    • [object Object] (aclrtStream, input): stream for executing the task.
  • Returns:

    [object Object]: status code. For details, see .

[object Object]
  • Deterministic computing:

    • [object Object] defaults to a deterministic implementation. The input and output support the following data type combinations: 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.

  • [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]:

    Parameters of the aclnnNpuFormatCastCalculateSizeAndFormat API:

    [object Object]undefined

    aclnnNpuFormatCastGetWorkspaceSize API:

    [object Object]undefined

    C0 calculation method: C0=32Bsize of BasictypeofsrcTensorC0=\frac{32B}{size\ of\ Basic type of srcTensor}

    [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.
[object Object]

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]