FilesLast commitLast update
2 months ago
2 months ago
2 months ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
16 days ago
README

MatrixSetDiagV2

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 ×

Function Description

  • Operator function: replaces the diagonal elements of the input tensor with the values of the diagonal tensor.

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
input Input Original tensor to be replaced. FLOAT, FLOAT16, BFLOAT16, INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, BOOL, COMPLEX64, DOUBLE ND
diagonal Input Diagonal tensor. Same as the data type of input. ND
k Input Value range of diagonals. INT32. ND
output Output Tensor after replacement. Same as the data type of input. ND

Constraint Description

  • The number of dimensions of input is at least 2 and at most 8.
  • k is a scalar or a vector of length 2 with the data type INT32.
  • When k is a vector of length 2, k[1] >= k[0] must be satisfied.
  • When k is a scalar or k[0] = k[1] (single diagonal), the number of dimensions of diagonal is 1 less than that of input: the length of the last dimension is maxDiagLen = min(row + min(k[1], 0), col - max(k[0], 0)), where row and col are the lengths of the last two dimensions of input respectively; the other dimensions are one-to-one equal to the corresponding dimensions of input.
  • When k is not a scalar and k[0] != k[1] (multiple diagonals), the number of dimensions of diagonal is the same as that of input: the lengths of the last two dimensions are numDiags = k[1] - k[0] + 1 and maxDiagLen = min(row + min(k[1], 0), col - max(k[0], 0)) respectively, where row and col are the lengths of the last two dimensions of input, and numDiags is the number of diagonals; except for the last two dimensions, the other dimensions are one-to-one equal to the corresponding dimensions of input.

Invocation Description

Invocation Method Sample Code Description
Graph-mode invocation test_geir_matrix_set_diag_v2 Invokes the MatrixSetDiagV2 operator by building a graph through the operator IR.