[object Object]

[object Object][object Object]undefined
[object Object]
  • Description: Sets the elements of the input tensor self (last two dimensions) to 0 in the lower triangular part below the main diagonal. The diagonal parameter can be set to a positive or negative value. The default value is 0. A positive value indicates diagonals above the main diagonal. A negative value indicates diagonals below the main diagonal.

  • Formula: In the following formula, i indicates the sequence number of the element in the second-to-last dimension (i is the row index), j indicates the sequence number of the element in the last dimension (j is the column index), and d indicates diagonal. In the two-dimensional coordinate diagram corresponding to (i, j), i+d==j indicates that the element is on the diagonal.

    Forthediagonalanditsuppertriangularpart,thatis,i+d<=j,theoriginalvalueisretained:outi,j=selfi,j.Forthelowertriangularpart,thatis,i+d>j,thevalueissettozero(excludingthediagonal):outi,j=0.For the diagonal and its upper triangular part, that is, i + d < = j, the original value is retained: out_{i, j} = self_{i, j}\\. For the lower triangular part, that is, i + d > j, the value is set to zero (excluding the diagonal): out_{i, j} = 0.
  • Example:

    self=[[963][123][341]]self = \begin{bmatrix} [9&6&3] \\ [1&2&3] \\ [3&4&1] \end{bmatrix}, The result of triu(self, diagonal=0) is as follows: [[963][023][001]]\begin{bmatrix} [9&6&3] \\ [0&2&3] \\ [0&0&1] \end{bmatrix}; Adjust the value of diagonal. The result of triu(self, diagonal=1) is as follows: [[063][003][000]]\begin{bmatrix} [0&6&3] \\ [0&0&3] \\ [0&0&0] \end{bmatrix}; Adjust the value of diagonal to -1. The result of triu(self, diagonal=-1) is as follows: [[963][123][041]]\begin{bmatrix} [9&6&3] \\ [1&2&3] \\ [0&4&1] \end{bmatrix}.

[object Object]
  • aclnnTriu and aclnnInplaceTriu implement the same function in different ways. Select a proper operator based on your requirements.
    • aclnnTriu: An output tensor object needs to be created to store the computation result.
    • aclnnInplaceTriu: No output tensor object needs to be created, and the computation result is stored in the memory of the input tensor.
  • Each operator has calls. First, [object Object] or [object Object] is called to obtain input parameters and calculate the required workspace size based on the computation process. Then, [object Object] or [object Object] is called to perform computation.
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
  • Parameters

    [object Object]
    • Ascend 950PR/Ascend 950DT: Only COMPLEX32 and COMPLEX64 are supported.
    • [object Object]Atlas inference products[object Object] and [object Object]Atlas training products[object Object]: The data type cannot be BFLOAT16.
  • Return Value

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

    The first-phase API implements input parameter validation. The following error codes may be returned.

    [object Object]
[object Object]
  • Parameters

    [object Object]
  • Return Value

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

[object Object]
  • Parameters

    [object Object]
    • Ascend 950PR/Ascend 950DT: Only COMPLEX32 and COMPLEX64 are supported.
    • [object Object]Atlas inference products[object Object] and [object Object]Atlas training products[object Object]: The data type cannot be BFLOAT16.
  • Return Value

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

    The first-phase API implements input parameter validation. The following error codes may be returned.

    [object Object]
[object Object]
  • Parameters

    [object Object]
  • Return Value

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

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

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

[object Object]