---
title: GetOptionalInputTensor
description: "- 头文件：#include <exe_graph/runtime/eager_op_execution_context.h>"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendgraphapi/atlasgeapi_07_0693.html
sourcePath: /source/zh/canncommercial/900/API/ascendgraphapi/atlasgeapi_07_0693.html
indexId: b9e005b26f41c33fdec3de8fb2b81c2c3ca0455db865833c208fa1a8f36dd2ef72
---
# GetOptionalInputTensor

#### 头文件/库文件

- 头文件：#include <exe_graph/runtime/eager_op_execution_context.h>
- 库文件：liblowering.so


#### 功能说明

基于算子IR原型定义，获取OPTIONAL_INPUT类型的输入tensor指针。


#### 函数原型

```
const Tensor *GetOptionalInputTensor(size_t ir_index) const
```


#### 参数说明

| 参数名 | 输入/输出 | 描述 |
| --- | --- | --- |
| ir\_index | 输入 | IR原型定义中的index。 |


#### 返回值说明

Tensor指针，异常时返回空指针。


#### 约束说明

无
