---
title: keep_tensors_dtypes
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/TensorFlowCommercial/latest/migration/tfmigr1/tfmigr1_tfadapi_0089.html
sourcePath: /source/zh/TensorFlowCommercial/900/migration/tfmigr1/tfmigr1_tfadapi_0089.html
indexId: 9bbf52ecb9493abf46c95074f933ceff768b6ae46df7c106bac0c1abfb5cbe0479
---
# keep_tensors_dtypes

#### 产品支持情况

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


#### 功能说明

指定哪些算子保持原有精度。


#### 函数原型

```
def keep_tensors_dtypes(graph, input_tensors)
```


#### 参数说明

| 参数名 | 输入/输出 | 描述 |
| --- | --- | --- |
| graph | 输入 | 从pb模型导入的图。 |
| input\_tensors | 输入 | 需要保持精度的算子名称。 |


#### 返回值

无


#### 使用约束

- 该接口仅适用于在线推理场景。
- 算子精度模式为保持原图精度（即precision_mode指定为must_keep_origin_dtype）时，该接口不生效。


#### 调用示例

```
from npu_bridge.estimator.npu import util
g=tf.Graph()
util.keep_tensors_dtypes(g,("random_uniform_1/sub:0",))
```
