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

#### 产品支持情况

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


#### 头文件/库文件

- 头文件：#include <ge/ge_api.h>
- 库文件：libge_runner.so


#### 功能说明

设置Graph的Const内存基址。

内存大小从GetCompiledGraphSummary>GetConstMemorySize接口中获取。


#### 函数原型

```
Status SetGraphConstMemoryBase(uint32_t graph_id, const void *const memory, size_t size)
```


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| graph\_id | 输入 | 子图对应的ID。 |
| memory | 输入 | 设置的Const内存基地址。 |
| size | 输入 | 设置的Const内存大小。 |


#### 返回值说明

| 参数名 | 类型 | 说明 |
| --- | --- | --- |
| \- | Status | SUCCESS：设置成功。 FAILED：设置失败。 |


#### 约束说明

- 在调用本接口前，必须先调用  CompileGraph
接口进行图编译。
- 每个Graph只支持设置一次，不支持刷新。
- 该接口只适用于静态编译图，可以通过  GetCompiledGraphSummary
接口中的IsStatic接口获取图是否为静态编译。
- 若使用了本接口，又配置了  RegisterExternalAllocator
接口，则RegisterExternalAllocator接口不生效。
