code: def add_convert_command(subparsers):
      def add_import_arg(parser):
          parser.add_argument(
              "-I",
              "--import-format",
              type=str,
              default="NNP",
              help="[import] import format. (one of [{}])".format(
                  import_formats_string
              ),
          )
          parser.add_argument(
              "-E",
              "--nnp-import-executor-index",
              type=int,
              default=None,
              help="[import][NNP] import only specified executor.",
          )
          parser.add_argument(
              "--nnp-exclude-preprocess",
              action="store_true",
              help="[import][NNP] EXPERIMENTAL exclude preprocess functions when import.",
          )
          parser.add_argument(
              "--nnp-no-expand-network",
              action="store_true",
              help="[import][NNP] expand network with repeat or recurrent.",
          )
  
      import_formats_string = ",".join(
          nnabla.utils.converter.formats.import_name
      )
  
      ################################################################################
      # Dump Network.
      subparser = subparsers.add_parser(
          "dump", help="Dump network with supported format."
      )
      subparser.add_argument(
          "-v",
          "--dump-verbose",
          action="store_true",
          help="[dump] verbose output.",
      )
      subparser.add_argument(
          "-F",
          "--dump-functions",
          action="store_true",
          help="[dump] dump function list.",
      )
      subparser.add_argument(
          "-V",
          "--dump-variables",
          action="store_true",
          help="[dump] dump variable list.",
      )
      subparser.add_argument(
          "--dump-limit",
          type=int,
          default=-1,
          help="[dump] limit num of items.",
      )
      subparser.add_argument(
          "-n",
          "--dump-variable-name",
          type=str,
          default=None,
          help="[dump] Specific variable name to display.",
      )
      subparser.add_argument(
          "files",
          metavar="FILE",
          type=str,
          nargs="+",
          help="File or directory name(s) to convert.",
      )
      # import option
      add_import_arg(subparser)
      subparser.set_defaults(func=dump_command)
  
      ################################################################################
      # Generate NNB template
      subparser = subparsers.add_parser(
          "nnb_template", help="Generate NNB config file template."
      )
      subparser.add_argument(
          "files",
          metavar="FILE",
          type=str,
          nargs="+",
          help="File to generate NNB config file template. The last is setting yaml file.",
      )
      # import option
      add_import_arg(subparser)
  
      subparser.add_argument(
          "-b",
          "--batch-size",
          type=int,
          default=-1,
          help="[export] overwrite batch size.",
      )
      subparser.add_argument(
          "-T",
          "--default-variable-type",
          type=str,
          nargs=1,
          default=["FLOAT32"],
          help="Default type of variable",
      )
      subparser.add_argument(
          "--api",
          type=int,
          default=-1,
          help="Set API Level to convert to, default is highest API Level.",
      )
  
      subparser.set_defaults(func=nnb_template_command)
  
      ################################################################################
      # Converter
      subparser = subparsers.add_parser(
          "convert", help="File format converter."
      )
      subparser.add_argument(
          "files",
          metavar="FILE",
          type=str,
          nargs="+",
          help="File or directory name(s) to convert. \
                             (When convert ckpt format of the tensorflow model, \
                             If the version of the checkpoint is V1, need to enter the `.ckpt` file, \
                             otherwise need to enter the `.meta` file.)",
      )
      # import option
      subparser.add_argument(
          "--outputs",
          type=str,
          default=None,
          help="[import][tensorflow] The name(s) of the output nodes, comma separated. \
                             Only needed when convert CKPT format.",
      )
      subparser.add_argument(
          "--inputs",
          type=str,
          default=None,
          help="[import][tensorflow] The name(s) of the input nodes, comma separated. \
                             Only needed when convert CKPT format.",
      )
      add_import_arg(subparser)
  
      # export option
      export_formats_string = ",".join(
          nnabla.utils.converter.formats.export_name
      )
      subparser.add_argument(
          "-O",
          "--export-format",
          type=str,
          default="NNP",
          help="[export] export format. (one of [{}]), \
                                  the export file format is 'CSRC' or 'SAVED_MODEL' that \
                                  argument '--export-format' will have to be set!!!".format(
              export_formats_string
          ),
      )
      subparser.add_argument(
          "-f",
          "--force",
          action="store_true",
          help="[export] overwrite output file.",
      )
      subparser.add_argument(
          "-b",
          "--batch-size",
          type=int,
          default=1,
          help="[export] overwrite batch size.",
      )
      subparser.add_argument(
          "-S",
          "--split",
          type=str,
          default=None,
          help='[export] This option need to set  "-E" option.'
          + "Split executor with specified index. "
          + '(eg. "1-9", "1-2,5-")',
      )
      subparser.add_argument(
          "-d",
          "--define_version",
          type=str,
          default=None,
          help="[export][ONNX] define onnx opset version. e.g. opset_6"
          + "\n"
          + "[export][ONNX] define convert to onnx for SNPE. e.g. opset_snpe"
          + "\n"
          + "[export][ONNX] define convert to onnx for TensorRT. e.g. opset_tensorrt"
          + "\n"
          + "[export][NNB] define binary format version. e.g. nnb_3",
      )
      subparser.add_argument(
          "--enable-optimize-pb",
          action="store_true",
          help="[export][tensorflow] enable optimization when export to pb or tflite.",
      )
      subparser.add_argument(
          "--channel-last",
          action="store_true",
          help="[export][TFLite] Specify the data_format of the NNP network,\
                             data_format default is channel_first",
      )
      subparser.add_argument(
          "--quantization",
          action="store_true",
          help="[export][TFLite] export to INT8 quantized tflite model.",
      )
      subparser.add_argument(
          "--dataset",
          type=str,
          default=None,
          help="[export][TFLite] Specify the path of represent dataset which will be passed to INT8 quantized tflite converter.",
      )
      subparser.add_argument(
          "--ir_version",
          type=int,
          default=-1,
          help="[export] Set ONNX IR version to convert to, \
                             default is the latest supported IR version corresponding to the current ONNX version.",
      )
  
      # For config function list
      subparser.add_argument(
          "-c",
          "--config",
          type=str,
          default=None,
          help="[export] config target function list.",
      )
  
      # NNP
      subparser.add_argument(
          "--nnp-parameter-h5",
          action="store_true",
          help="[export][NNP] store parameter with h5 format",
      )
      subparser.add_argument(
          "--nnp-parameter-nntxt",
          action="store_true",
          help="[export][NNP] store parameter into nntxt",
      )
      subparser.add_argument(
          "--nnp-exclude-parameter",
          action="store_true",
          help="[export][NNP] output without parameter",
      )
      subparser.add_argument(
          "--nnp-version",
          type=str,
          default=None,
          help="[export][NNP] specify the version of nnp (e.g. 1.25.0)",
      )
  
      # Both NNB and CSRC
      subparser.add_argument(
          "-T",
          "--default-variable-type",
          type=str,
          nargs=1,
          default=["FLOAT32"],
          help="Default type of variable",
      )
      subparser.add_argument(
          "-s",
          "--settings",
          type=str,
          nargs=1,
          default=None,
          help="Settings in YAML format file.",
      )
      subparser.add_argument(
          "--api",
          type=int,
          default=-1,
          help="Set API Level to convert to, default is highest API Level.",
      )
  
      subparser.set_defaults(func=convert_command)
  
file_path: nnabla/python/src/nnabla/utils/cli/convert.py
imports: import os
  import nnabla.logger
  import nnabla.utils.converter
label_desc: Use image node_id 5 for calling a global function with example usage: add_convert_command(subparsers) without return types