keep_dtype_scope

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Description

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

Prototype

def keep_dtype_scope()

Parameters

None

Restrictions

This API does not take effect if the original precision is preserved (that is, precision_mode is set to must_keep_origin_dtype).

Returns

None

Example

1
2
with npu_scope.keep_dtype_scope(): 
    X = tf.conv2d(a)