| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 个月前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 3 个月前 | ||
| 1 个月前 |
GatherNd
产品支持情况
| 产品 | 是否支持 |
|---|---|
| Ascend 950PR/Ascend 950DT | √ |
| Atlas A3 训练系列产品/Atlas A3 推理系列产品 | × |
| Atlas A2 训练系列产品/Atlas A2 推理系列产品 | × |
| Atlas 200I/500 A2 推理产品 | × |
| Atlas 推理系列产品 | × |
| Atlas 训练系列产品 | × |
功能说明
-
算子功能:对于维度为r≥1的输入张量
self,和维度q≥1的输入张量indices,将数据切片收集到维度为 (q-1) + (r - indices_shape[-1]) 的输出张量out中。indices是一个q维的整型张量,可视作一个q-1维的由索引对构成的特殊张量(每个索引对是一个长度为indices_shape[-1]的一维张量,每个索引对指向self中一个切片)。 -
计算流程:
- 如果indices_shape[-1] > r,不合法场景。
- 如果indices_shape[-1] = r,则输出张量out的维度为q-1,即out的shape为 [indices_shape[0:q-1]],out中元素为self的索引对位置的元素。(见例1)
- 如果indices_shape[-1] < r,则输出张量out的维度为(q-1) + (r - indices_shape[-1]),设c=indices_shape[-1],即out的shape为 [indices_shape[0:q-1],self_shape[c:r]],
out由self的索引对位置的切片组成。(见例2、例3、例4)
关于r、q、indices_shape[-1] 的一些限制条件如下:
- 必须满足r≥1,q≥1。
- indices_shape[-1]的值必须满足在1(包含)和r(包含)之间。
indices的每个元素,必须在[-s, s-1]范围内(s为self_shape各个轴上的值),即-self_shape[i]≤indices[...,i]≤self_shape[i]-1。
-
示例:
例1: self: [[0, 1],[2, 3]] # self_shape=[2, 2], r=2 indices: [[0, 0], [1, 1]] # indices_shape=[2, 2], q=2, indices_shape[-1]=2 out: [0, 3] # out_shape=[2] 例2: self: [[0, 1],[2, 3]] # self_shape=[2, 2], r=2 indices: [[1], [0]] # indices_shape=[2, 1], q=2, indices_shape[-1]=1 out: [[2, 3], [0, 1]] # out_shape=[2, 2] 例3: self: [[[0, 1],[2, 3]], [[4, 5],[6, 7]]] # self_shape=[2, 2, 2], r=3 indices: [[0, 1], [1, 0]] # indices_shape=[2, 2], q=2, indices_shape[-1]=2 out: [[2, 3], [4, 5]] # out_shape=[2, 2] 例4: self: [[[0, 1],[2, 3]], [[4, 5],[6, 7]]] # self_shape=[2, 2, 2], r=3 indices: [[[0, 1]], [[1, 0]]] # indices_shape=[2, 1, 2], q=3, indices_shape[-1]=2 out: [[[2, 3]], [[4, 5]]] # out_shape=[2, 1, 2]
参数说明
| 参数名 | 输入/输出 | 描述 | 数据类型 | 数据格式 |
|---|---|---|---|---|
| self | 输入 | 输入aclTensor。 | INT64、INT32、INT8、UINT8、BOOL、FLOAT、FLOAT16、BFLOAT16、DOUBLE、INT16、UINT16、UINT32、UINT64 | ND |
| indices | 输入 | 输入aclTensor。 | INT32、INT64 | ND |
| negativeIndexSupport | 输入 | onnx模型是否存在负索引。 | BOOL | - |
| out | 输出 | 输出aclTensor。 | 与self一致 | ND |
- Atlas A2 训练系列产品/Atlas A2 推理系列产品、Atlas A3 训练系列产品/Atlas A3 推理系列产品:数据类型不支持DOUBLE、INT16、UINT16、UINT32、UINT64。
- Atlas 训练系列产品、Atlas 推理系列产品:数据类型不支持BFLOAT16、DOUBLE、INT16、UINT16、UINT32、UINT64。
约束说明
无
调用说明
| 调用方式 | 调用样例 | 说明 |
|---|---|---|
| aclnn调用 | test_aclnn_gather_nd | 通过aclnnGatherNd接口方式调用GatherNd算子。 |