Eye
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: generates a tensor with element values of 1 on the diagonal and 0 elsewhere. If batch_shape is not specified, the output is two-dimensional (num_rows, num_columns); if batch_shape is specified, the output is a multi-dimensional tensor of batch_shape + (num_rows, num_columns), where each two-dimensional slice has 1 on the diagonal and 0 elsewhere.
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| num_rows | Attribute | Indicates the first dimension of the output tensor, an integer on the host. The value range is greater than 0. | INT64 | - |
| num_columns | Optional Attribute | Indicates the second dimension of the output tensor, an integer on the host. A value not greater than 0 indicates the same as num_rows. The default value is 0. | INT64 | - |
| batch_shape | Optional Attribute | Indicates the batch dimensions of the output tensor, an integer list on the host. Each item must be greater than 0, and the default value is [] (the output is two-dimensional). | INT64 (ListInt) | - |
| dtype | Optional Attribute | Indicates the data type of the output tensor, an integer on the host, corresponding to a data type enumeration value. The default value is 0 (FLOAT32). The supported data types are the same as those of y. | INT64 | - |
| y | Output | Indicates the output tensor, with element values of 1 on the diagonal and 0 elsewhere. The shape is batch_shape + (num_rows, num_columns), or two-dimensional (num_rows, num_columns) if batch_shape is not specified. | BFLOAT16, FLOAT16, FLOAT32, UINT8, INT8, INT16, INT32, INT64, BOOL | ND |
Constraint Description
None
Invocation Description
| Invocation Method | Invocation Sample | Description |
|---|---|---|
| aclnn invocation | test_aclnn_eye | Invokes the Eye operator through the aclnnEye API. For the API parameters (n, m, out) and constraints, see the API document. |
| Graph mode invocation | - | For the graph IR definition, see the Eye prototype. The operator prototype is Eye(num_rows, num_columns=0, batch_shape=[], dtype=0) -> y. |