--mode
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Description
Sets the run mode.
See Also
- If --mode is set to 1 or 5, use this option in conjunction with --om and --json. To convert the original model file into a JSON file with shape information, use this option together with --dump_mode.
- If --mode is set to 6, use this option in conjunction with --om.
- If --mode is set to 3 and you need to specify the path for saving the precheck result, use this option together with --check_report.
Argument
Argument:
- 0 (default): Generates an offline model adapted to the Ascend AI Processor as a *.om file.
- 1: Converts the offline model or original model file into a JSON file to facilitate model overview.
- 3: Performs precheck only for model validation.
- 5: Converts a dumped graph file into a JSON file to facilitate locating by parsing the dumped graph generated during graph build (ge_proto*.txt files only; ge_onnx*.pbtxt files are not supported).
- 6: Returns the information of an existing offline model, including the model's usage of key resources, information about the compilation environment and operating environment, and more.
Restrictions:
If --mode is set to 5, you need to set the related environment variables and obtain the dumped graph files. For details, see 2.c. After the environment variables are set and the model conversion is complete, the corresponding graph files are generated in the current path where the atc command is executed.
Suggestions and Benefits
None
Example
- If the value is 0:
atc --mode=0 --framework=3 --model=$HOME/module/resnet50_tensorflow*.pb --output=$HOME/module/out/tf_resnet50 --soc_version=<soc_version> - If the value is 1:
- To convert an offline model into a JSON file:
--mode=1 --om=$HOME/module/out/tf_resnet50.om --json=$HOME/module/out/tf_resnet50.json
- To convert an original model into a JSON file:
--mode=1 --om=$HOME/module/resnet50_tensorflow*.pb --json=$HOME/module/out/tf_resnet50.json --framework=3
- To convert an offline model into a JSON file:
- If the value is 3:
atc --mode=3 --framework=3 --model=$HOME/module/resnet50_tensorflow*.pb --soc_version=<soc_version>After the command is executed, the precheck result file check_result.json is generated in the current path.
- If the value is 5:
--mode=5 --om=$HOME/module/ge_proto_00000000_PreRunBegin.txt --json=$HOME/module/out/ge_proto.json
- If the value is 6:
atc --mode=6 --om=$HOME/module/out/tf_resnet50.om
After the command is executed successfully, you should see messages similar to the following:
1 2 3 4 5 6 7 8 9 10
============ Display Model Info start ============ # atc command used for model conversion Original Atc command line: ${INSTALL_DIR}/bin/atc.bin --model=$HOME/module/resnet50_tensorflow*.pb --framework=3 --output=$HOME/module/out/tf_resnet50 --soc_version=<soc_version> --display_model_info=1 # ATC version, SoC version, and original framework type system info: atc_version[xxx], soc_version[xxx], framework_type[xxx]. # Memory usage, weight, number of logic streams, and number of events at run time resource info: memory_size[xxx B], weight_size[xxx B], stream_num[xxx], event_num[xxx]. # Size of each partition in the offline model file, including the ModelDef, weight, tbe_kernels, task_info, and SO files om info: modeldef_size[xxx B], weight_data_size[xxx B], tbe_kernels_size[xxx B], cust_aicpu_kernel_store_size[xxx B], task_info_size[xxx B], so_store_size[xxx B]. ============ Display Model Info end ============
Dependencies and Restrictions
None