---
title: ScopeFeature构造函数和析构函数
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/TensorFlowCommunity/latest/Convergence/tfscopedevg/atlassfpapi_07_0170.html
sourcePath: /source/zh/TensorFlowCommunity/910/Convergence/tfscopedevg/atlassfpapi_07_0170.html
indexId: b84165938a61e0fdc99091779cfb827dd67ead084054f867d27cb5a78313379b83
---
# ScopeFeature构造函数和析构函数

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Ascend 950PR / Ascend 950DT | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |


#### 函数功能

ScopeFeature构造函数和析构函数。


#### 函数原型

数据类型为string的接口后续版本会废弃，建议使用数据类型为非string的接口。


```
ScopeFeature(std::string sub_type, int32_t num, std::string suffix = "", std::string sub_scope_mask = "", int32_t step = 0);
ScopeFeature(const char_t *sub_type, int32_t num, const char_t *suffix, const char_t *sub_scope_mask, int32_t step = 0);
ScopeFeature(ScopeFeature const &feature);
ScopeFeature &operator=(ScopeFeature const &feature);
~ScopeFeature() override;
```


#### 参数说明

| 参数名 | 输入/输出 | 描述 |
| --- | --- | --- |
| sub\_type | 输入 | sub\_scope的type类型。 |
| num | 输入 | scope中所有sub\_scope的type类型与sub\_type相同的个数。 |
| suffix | 输入 | scope的后缀名（LastName并去掉index）。 假设scope的名称为：fastrcnn\_predictions/strided\_slice\_1，则sub\_scope\_mask配置为strided\_slice时可以匹配成功。 |
| sub\_scope\_mask | 输入 | sub\_scope后缀名（LastName并去掉index）的掩码。 假设sub\_scope的名称为：fastrcnn\_predictions/strided\_slice\_1，则sub\_scope\_mask配置为slice时可以匹配成功。 |
| step | 输入 | 步长，用户无需设置，保持默认0。 |
| feature | 输入 | ScopeFeature对象。 |


#### 返回值

ScopeFeature构造函数返回ScopeFeature类型的对象。


#### 异常处理

无。


#### 约束说明

无。
