---
title: atb/operation_infra.h
description: "定义ATB的OperationInfra类。该接口类定义了加速库插件算子的基类，基类提供了一些内置公共接口供用户编写自己的插件算子。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendtb/ascendtb_01_0125.html
sourcePath: /source/zh/canncommercial/900/API/ascendtb/ascendtb_01_0125.html
indexId: 7a8faa87223376278b973c50b2f0daced715e31f00e01147866335efd4e3b9f764
---
# atb/operation_infra.h

#### 功能说明

定义ATB的OperationInfra类。该接口类定义了加速库插件算子的基类，基类提供了一些内置公共接口供用户编写自己的插件算子。


#### 定义

```
class OperationInfra : public Operation {
public:
    OperationInfra();
    OperationInfra(const OperationInfra &other);
    OperationInfra& operator = (const OperationInfra &other);
    ~OperationInfra() override;
    void SetExecuteStreamId(uint32_t streamId);
    uint32_t GetExecuteStreamId() const;
    aclrtStream GetExecuteStream(Context *context);
private:
    std::unique_ptr<OperationImpl> impl_;
};
```


#### 参数列表

| 成员名称 | 参数 | 返回值 | 描述 |
| --- | --- | --- | --- |
| OperationInfra | \- | \- | 构造函数。 |
| OperationInfra | other | \- | 拷贝构造函数。 other：拷贝的对象。 |
| operator = | other | OperationInfra& | 赋值构造函数。 other：赋值的对象。 如果执行成功，返回对象本身。 |
| ~OperationInfra | \- | \- | 析构函数。 |
| SetExecuteStreamId | streamId | \- | 设置该Operation需要使用的stream的id，id为context中的stream序号，该接口需要配合GetExecuteStream接口使用。 streamId：需要设置的stream的id。 |
| GetExecuteStreamId | \- | uint32\_t | 获取当前Operation使用的stream的id。 如果执行成功，返回stream的id，id为context中的stream序号。 |
| GetExecuteStream | context | aclrtStream | 获取当前Operation使用的stream。 context：Operation使用的Context。 如果执行成功，返回当前Operation使用的stream。 |
