FilesLast commitLast update
13 days ago
2 months ago
19 days ago
13 days ago
19 days ago
16 days ago
19 days ago
6 days ago
6 days ago
README

FillDiagonalV2

English | 简体中文

Product Support Status

Product Supported
Ascend 950PR&950DT products √
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products ×
Atlas inference products √
Atlas training products ×
Kirin X90 processor series products √
Kirin 9030 processor series products √

Function Description

  • Operator function: fills the diagonal of the tensor with fillValue.
  • Computation formula:
    • Taking 2D as an example, when wrap is False, the fill positions are [r, r], where 0 <= r < m and m = min(col, row). col is the length of the column, and row is the length of the row.
    • When wrap is True, filling is performed based on the flattened one-dimensional index: for a non-negative integer i that satisfies (col + 1) * i < row * col, the fill position is [floor((col + 1) * i / col), ((col + 1) * i) % col].

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
selfRef Input/Output tensor Input/Output tensor. Non-contiguous Tensors are supported. BFLOAT16, FLOAT16, FLOAT, DOUBLE, INT8, INT16, INT32, INT64, UINT8, BOOL ND
fillValue Input Fill value. Its data type must be a data type that can be converted to FLOAT and does not overflow when converted to the data type of selfRef. Data types that can be converted to FLOAT -
wrap Attribute Optional attribute. The default value is False. It indicates the fill mode and is valid only for 2D input Tensors. This parameter is ignored when the input has more than 2 dimensions. For a tall matrix (the number of rows is greater than the number of columns), if wrap is True, a new diagonal is formed every m+1 rows, where m = min(col, row). BOOL -
  • Atlas inference products and Kirin X90/Kirin 9030 processor series products: BFLOAT16 is not supported.

Constraint Description

  • The number of dimensions of selfRef must be greater than 1.
  • When selfRef has more than 2 dimensions, the lengths of all dimensions must be the same.
  • fillValue must be convertible to the FLOAT type, and overflow must not occur when it is converted to the data type of selfRef.

Invocation Description

Invocation Method Sample Code Description
aclnn API test_aclnn_inplace_fill_diagonal Invokes the InplaceFillDiagonal operator through the aclnnInplaceFillDiagonal API.