---
title: GetRequiredOutputFormat
description: "根据算子原型定义中的输出索引获取对应的必选输出Format指针。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/maintenref/basicdataapi/atlasopapi_07_00586.html
sourcePath: /source/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi_07_00586.html
indexId: d419f467518939ab610984e8d1ee78a7b4d09a595b4b1dabd76d3c17d2fed95f78
---
# GetRequiredOutputFormat

#### 函数功能

根据算子原型定义中的输出索引获取对应的必选输出Format指针。


#### 函数原型

```
StorageFormat *GetRequiredOutputFormat(const size_t ir_index)
```


#### 参数说明

| 参数 | 输入/输出 | 说明 |
| --- | --- | --- |
| ir\_index | 输入 | IR原型定义中的index，从0开始计数。 |


#### 返回值说明

输出Format指针，ir_index非法时，返回空指针。

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


#### 约束说明

无。


#### 调用示例

```
ge::graphStatus InferFormatForXXX(InferFormatContext *context) {
  auto format = context->GetRequiredOutputFormat(0);
   // ...
}
```
