---
title: Init
description: 初始化图算子。
url: "https://www.hiascend.com/document/detail/zh/canncommercial/900/API/ascendtb/ascendtb_01_0109.html"
---

# Init

#### 功能说明

初始化图算子。

定义图算子的名称，输入输出及shape传导规则。


#### 定义

```
virtual Status Init (const std::string &opName, const InferShapeFunc &inferShapeFunc, const SVector<std::string> &inTensorNames, const SVector<std::string> &outTensorNames)=0
```


#### 成员

| 成员名称 | 描述 |
| --- | --- |
| opName | 图算子的名称。 |
| inferShapeFunc | 图算子的shape传导规则。 |
| inTensorNames | 输入tensor名称。 |
| outTensorNames | 输出tensor名称。 |


#### 返回值

状态值。如果设置成功，返回NO_ERROR。
