---
title: MatchNext
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendgraphapi/atlasgeapi_07_0217.html
sourcePath: /source/zh/canncommercial/900/API/ascendgraphapi/atlasgeapi_07_0217.html
indexId: 363867af4b9643b0f472d67d180c2107caca8705e0749286550acb9c4af4ae4572
---
# MatchNext

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |


#### 头文件/库文件

- 头文件：#include <ge/fusion/pattern_matcher.h>
- 库文件：libge_compiler.so


#### 功能说明

按照当前Target Graph的拓扑顺序，返回下一个符合Pattern定义的匹配结果。

提供逐一匹配接口可解决Overlap场景下的选择问题。用户可循环调用该接口。

说明：

- 当前接口返回的匹配结果可能存在重叠，调用者需要自己处理
  考虑如下结构，当对ABC做匹配时，C会先后出现在2个匹配结果中，选取哪个结果需要调用者自行决定。

```
B  C   B
\ / \ /
A   A
```


- 该函数只匹配当前图，若Target Graph带子图，调用者需自行对子图进行匹配。


#### 函数原型

```
std::unique_ptr<MatchResult> MatchNext()
```


#### 参数说明

无


#### 返回值说明

| 参数名 | 类型 | 说明 |
| --- | --- | --- |
| \- | std::unique\_ptr<MatchResult> | 匹配结果。 |


#### 约束说明

无
