npu.keep_dtype_scope

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Description

Specifies the operators that preserve the original precision. If the operator precision in an original network model is not supported by the AI processor, the system automatically uses the high precision supported by the operators for compute.

Prototype

1
npu.keep_dtype_scope()

Parameters

None

Returns

Python context manager. Operators in the context have special attributes identified by the NPU.

Example

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