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

#### 产品支持情况

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


#### 头文件

#include <graph/ct_infer_shape_context.h>


#### 功能说明

获取InferenceContext指针。


#### 函数原型

```
ge::InferenceContext *GetInferenceContext() const
```


#### 参数说明

无


#### 返回值说明

输出InferenceContext指针。

关于InferenceContext类型的定义，请参见InferenceContext。


#### 约束说明

无


#### 调用示例

```
ge::graphStatus InferShapeForXXX(CtInferShapeContext *context) {
  const auto &read_inference_context = ct_context->GetInferenceContext();
  // ...
}
```
