---
title: SetInferDataType
description: "使用图模式时，需要调用该接口注册DataType推导函数。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendcopapi/atlasascendc_api_07_0952.html
sourcePath: /source/zh/canncommercial/900/API/ascendcopapi/atlasascendc_api_07_0952.html
indexId: b83a12f5ce0d67f42bcaf043bdfb671b7243b4560e3a67b7a0e24e801d36cef476
---
# SetInferDataType

#### 功能说明

使用图模式时，需要调用该接口注册DataType推导函数。


#### 函数原型

```
OpDef &SetInferDataType(gert::OpImplRegisterV2::InferDataTypeKernelFunc func)
```


#### 参数说明

| 参数 | 输入/输出 | 说明 |  |  |
| --- | --- | --- | --- | --- |
| func | 输入 | DataType推导函数。InferDataTypeKernelFunc类型定义如下，入参类型参考InferDataTypeContext(https://www.hiascend.comdocument/detail/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi\_07\_00087.html)： 1 using InferDataTypeKernelFunc = UINT32 (\*)(InferDataTypeContext \*); | 1 | using InferDataTypeKernelFunc = UINT32 (\*)(InferDataTypeContext \*); |
| 1 | using InferDataTypeKernelFunc = UINT32 (\*)(InferDataTypeContext \*); |  |  |  |


#### 返回值说明

OpDef算子定义，OpDef请参考OpDef。


#### 约束说明

无
