--keep_dtype

Description

Keeps the computation precision of some operators unchanged during the compilation of the original network model.

In the inference scenario, --precision_mode can be used to set the global precision mode of a network model, but it may result in performance or accuracy problems on particular operators. Therefore, you can use --keep_dtype to keep the precision of these operators unchanged at build time.

See Also

Use this option in conjunction with --precision_mode. However, this option does not take effect when --precision_mode is set to must_keep_origin_dtype.

Arguments

Argument: directory (including the file name) of the operator configuration file, which lists operator names or operator types. Each operator must be in a separate line.

Restrictions:

Format: The directory (including the file name) can contain letters, digits, underscores (_), hyphens (-), periods (.), colons (:), and Chinese characters.

Suggestions and Benefits

None

Examples

  • To specify opnames, use the following template (named execeptionlist.cfg).
    Opname1
    Opname2
    ...
  • To specify optypes, use the following template (named execeptionlist.cfg).
    OpType::TypeName1
    OpType::TypeName2
    ...

The Relu operator in the TensorFlow ResNet50 network model is used as an example. The operator type defined by Ascend IR is Relu.

# Set the operator name.
fp32_vars/Relu
# Set the operator type.
OpType::Relu

Upload your execeptionlist.cfg file to any directory (for example, ${HOME}) on the server where AOE is located.

--keep_dtype=${HOME}/execeptionlist.cfg --precision_mode=force_fp16

During model compilation, the precision of the operators specified in the execeptionlist.cfg file will be preserved while those not specified in this file will be processed according to --precision_mode.

Dependencies and Restrictions

None