---
title: 索引类算子索引越界
description: "Host应用类日志（log/[run|debug]/plog/plog-pid_*.log）中存在索引类算子0x800000的报错。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/maintenref/troubleshooting/troubleshooting_0012.html
sourcePath: /source/zh/canncommercial/900/maintenref/troubleshooting/troubleshooting_0012.html
indexId: d55673d483c6cb8a0af25006dca2d57b91ff7b77f9bbf70a90c8aa894754cc4d82
---
# 索引类算子索引越界

#### 问题现象

Host应用类日志（log/[run|debug]/plog/plog-pid_*.log）中存在索引类算子0x800000的报错。

当前常见的索引类算子包括GatherV2（对应PyTorch的API为index_select）、Scatter（对应PyTorch的API为scatter_update）、GatherElements（对应PyTorch的API为gather）等，该类算子的特征为，一般有个输入名称是index、indices。


#### 故障根因

该类算子由于性能原因，算子自身无法做索引越界检查。因此无法正确报错，当索引越界时，可能会出现0x800000的AI Core ERROR。


#### 处理方法

以GatherV2算子为例，该算子对应PyTorch的API为index_select：

```
torch.index_select(input, dim, index, *, out=None)
```

该算子涉及input、dim、index等参数，若该算子出现0x800000，开发者可使用python打印功能，将input的shape、dim的值，以及index的值打印出来。进而进一步确定是索引越界。并通过查阅代码方式，查找index的来源，规则如下：

```
0 <= index[i] < input.shape[dim]
```
