--mode
Description
Sets the run mode.
See Also
Argument
Argument:
- 0: Generates an offline model adapted to the Ascend AI Processor, as a *.om file.
- 1: Converts the offline model or original model file into JSON format to facilitate model overview.
- 3: Performs precheck only for model validation.
- 5: Converts a GE dump graph file into a .json file, to facilitate locating by parsing the dump graph structure generated during GE graph encoding (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, set the following environment variable to dump a graph file before performing conversion:
export DUMP_GE_GRAPH=1
The preceding environment variable controls the graph dump mode. (1: dumps all. 2: dumps without data such as weights. 3: dumps only node relationships.)
You can set the following environment variable to control the graphs to dump:
export DUMP_GRAPH_LEVEL=1
This environment variable takes effect only when DUMP_GE_GRAPH is enabled. The default value is 2. It can be configured in either of the following ways. Both of them are used to control the number of flushed graphs. You can use them as required. Note that the two configuration methods cannot be used together.
- Set it to a value. Possible values are as follows:
- 1: dumps all graphs.
- 2 (default): dumps all graphs except subgraphs.
- 3: dumps the last generated graph, that is, the graph optimized and compiled by the GE.
- 4: dumps the earliest generated graph, that is, the entire graph that is first moved down to the device after the GE parsing and mapping operator. This graph has not been compiled or optimized by the GE.
- Set it to a character string separated by vertical bars (|):
For example, if this environment variable is set to aa|bb, graphs whose names contain aa and bb are dumped. aa and bb must be set to valid character strings during graph build. Valid strings can be obtained from a full dump of the graphs.
After the preceding variable is set, the dump output is generated in the current path where the atc command is executed.
Default: 0
Suggestions and Benefits
None
Example
- atc param1=value1 param2=value2 ... (No space is allowed before value. Otherwise, it will be truncated, and the value of param is empty.)
- atc param1 value1 param2 value2 ...
- If set to 0:
atc --mode=0 --framework=3 --model=$HOME/module/resnet50_tensorflow*.pb --output=$HOME/module/out/tf_resnet50 --soc_version=<soc_version> - If set to 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 set to 5:To convert a GE dump graph into a .json file:
--mode=5 --om=$HOME/module/ge_proto_00000000_PreRunBegin.txt --json=$HOME/module/out/ge_proto.json
- If set to 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:
============ 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 model definition (ModelDef), weight, TBE kernels (tbekernels), task info (taskinfo), 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 ============
Applicability
Dependencies and Restrictions
None