--mode

Applicable Products

All processors

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.

Arguments

Argument:

  • 0 (default): Generates an AI processor-adapted offline model as a *.om file.
  • 1: Converts the offline model or original model file into a JSON file for inspecting parameter information inside the model.
  • 3: Performs precheck only for model validation.
  • 5: Converts the dumped graph structure file to JSON format. This is used to parse the graph structure dumped during graph build (in ge_proto*.txt format; ge_onnx*.pbtxt is currently not supported) and convert it to JSON for easier troubleshooting.
  • 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 related environment variables and obtain the dumped graph structure file. For details, see 2.c. After the environment variables are set and the model conversion is complete, the corresponding graph structure file is generated in the current path where the atc command is executed.

Suggestions and Benefits

None

Example

  • 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:
      atc --mode=1 --om=$HOME/module/out/tf_resnet50.om  --json=$HOME/module/out/tf_resnet50.json
    • To convert an original model file into a JSON file:
      atc --mode=1 --om=$HOME/module/resnet50_tensorflow.pb  --json=$HOME/module/out/tf_resnet50.json  --framework=3
  • If set to 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 set to 5:
    atc --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:

     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