[object Object]

[object Object][object Object]undefined
[object Object]

Description: Generates a diagonal tensor. If the input [object Object] is a 1D tensor, the operator returns a 2D tensor by using elements of [object Object] as the diagonal. If the input is a 2D or multi-dimensional tensor, the operator flattens the input into a 1D tensor and then processes it accordingly.

[object Object]

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.

  • [object Object]
  • [object Object]
[object Object]
  • Parameters

    • [object Object] (aclTensor*, computation input): vector to be filled into the diagonal, [object Object] on the device. The maximum number of dimensions of [object Object] is 8. are supported. The can be ND.

      • [object Object]Atlas training products[object Object]: The data type can be FLOAT, FLOAT16, DOUBLE, INT32, INT64, INT16, INT8, UINT8, BOOL, or COMPLEX64.
      • [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 can be FLOAT, FLOAT16, DOUBLE, INT32, INT64, INT16, INT8, UINT8, BOOL, COMPLEX64, or BFLOAT16.
    • [object Object] (int64, computation input): specifies the diagonal. The data type can be INT64. [object Object] indicates the main diagonal, [object Object] indicates the diagonal above the main diagonal, and [object Object] indicates the diagonal below the main diagonal.

    • [object Object] (aclTensor*, computation output): are supported. The can be ND.

      • [object Object]Atlas training products[object Object]: The data type can be FLOAT, FLOAT16, DOUBLE, INT32, INT64, INT16, INT8, UINT8, BOOL, or COMPLEX64.
      • [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 can be FLOAT, FLOAT16, DOUBLE, INT32, INT64, INT16, INT8, UINT8, BOOL, COMPLEX64, or BFLOAT16.
    • [object Object] (uint64_t*, output): size of the workspace to be allocated on the device.

    • [object Object] (aclOpExecutor**, output): operator executor, containing 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] (uint64_t, 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, containing the operator computation process.

    • [object Object] (aclrtStream, input): stream for executing the task.

  • Returns

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

[object Object]
  • Deterministic computation:
    • [object Object] defaults to a deterministic implementation.

Note: The aclnnDiagFlat API does not support backward computation.

[object Object]

The following example is for reference only. For details, see .

[object Object]