keep_dtype_scope

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()

Options

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)