---
title: npu.keep_dtype_scope
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/TensorFlowCommercial/latest/migration/tfmigr2/tfmigr2_tfadapi_0023.html
sourcePath: /source/zh/TensorFlowCommercial/900/migration/tfmigr2/tfmigr2_tfadapi_0023.html
indexId: 15a2a70ba5b0ea3ae3845406670fa2c8edfd48601c399f06bbfa768f115478a879
---
# npu.keep_dtype_scope

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | ☓ |
| Atlas 推理系列产品 | ☓ |
| Atlas 训练系列产品 | √ |


#### 功能说明

指定哪些算子保持原有精度，如果原始网络模型中的算子精度在AI处理器上不支持，则系统内部自动采用算子支持的高精度来计算。


#### 函数原型

```
npu.keep_dtype_scope()
```


#### 参数说明

无。


#### 返回值

Python上下文管理器，在该上下文中的构图算子，会带有NPU识别的特殊属性。


#### 调用示例

```
import npu_device as npu
with npu.keep_dtype_scope():
    v = tf.add(1, 1)
```
