python/tvm/driver/tvmc/runner.py
def drive_run(args):
    """Invoke runner module with command line arguments

    Parameters
    ----------
    args: argparse.Namespace
        Arguments from command line parser.
    """

    path = pathlib.Path(args.PATH)
    options = None
    if args.device == "micro":
        path = path / "model.tar"
        if not path.is_file():
            TVMCException(
                f"Could not find model (model.tar) in the specified project dir {path.dirname()}."
            )

        # Check for options unavailable for micro targets.

        if args.rpc_key or args.rpc_tracker:
            raise TVMCException(
                "--rpc-key and/or --rpc-tracker can't be specified for micro targets."
            )

        if args.device != "micro":
            raise TVMCException(
                f"Device '{args.device}' not supported. "
                "Only device 'micro' is supported to run a model in MLF, "
                "i.e. when '--device micro'."
            )

        if args.profile:
            raise TVMCException("--profile is not currently supported for micro devices.")

        if args.print_time:
            raise TVMCException("--print-time is not currently supported for micro devices.")

        # Get and check options for micro targets.
        options = get_and_check_options(args.project_option, args.valid_options)

    else:
        # Check for options only availabe for micro targets.

        if args.list_options:
            raise TVMCException(
                "--list-options is only availabe on micro targets, i.e. when '--device micro'."
            )

    try:
        tvmc_package = TVMCPackage(package_path=path)
    except IsADirectoryError:
        raise TVMCException(f"File {path} must be an archive, not a directory.")
    except FileNotFoundError:
        raise TVMCException(f"File {path} does not exist.")
    except ReadError:
        raise TVMCException(f"Could not read model from archive {path}!")

    rpc_hostname, rpc_port = common.tracker_host_port_from_cli(args.rpc_tracker)

    try:
        inputs = np.load(args.inputs) if args.inputs else {}
    except IOError as ex:
        raise TVMCException("Error loading inputs file: %s" % ex)

    result = run_module(
        tvmc_package,
        args.device,
        hostname=rpc_hostname,
        port=rpc_port,
        rpc_key=args.rpc_key,
        inputs=inputs,
        fill_mode=args.fill_mode,
        repeat=args.repeat,
        number=args.number,
        profile=args.profile,
        options=options,
    )

    if args.print_time:
        stat_table = result.format_times()
        # print here is intentional
        print(stat_table)

    if args.print_top:
        top_results = get_top_results(result, args.print_top)
        # print here is intentional
        print(top_results)

    if args.outputs:
        # Save the outputs
        result.save(args.outputs)
Invoke runner module with command line arguments

    Parameters
    ----------
    args: argparse.Namespace
        Arguments from command line parser.
    
Invoke runner module with command line arguments
Parameters

argparse.Namespace
Arguments from command line parser.
Invoke runner module with command line arguments Parameters argparse . Namespace Arguments from command line parser .
def drive_run(args):
    path = pathlib.Path(args.PATH)
    options = None
    if args.device == "micro":
        path = path / "model.tar"
        if not path.is_file():
            TVMCException(
                f"Could not find model (model.tar) in the specified project dir {path.dirname()}."
            )
        if args.rpc_key or args.rpc_tracker:
            raise TVMCException(
                "--rpc-key and/or --rpc-tracker can't be specified for micro targets."
            )
        if args.device != "micro":
            raise TVMCException(
                f"Device '{args.device}' not supported. "
                "Only device 'micro' is supported to run a model in MLF, "
                "i.e. when '--device micro'."
            )
        if args.profile:
            raise TVMCException("--profile is not currently supported for micro devices.")
        if args.print_time:
            raise TVMCException("--print-time is not currently supported for micro devices.")
        options = get_and_check_options(args.project_option, args.valid_options)
    else:
        if args.list_options:
            raise TVMCException(
                "--list-options is only availabe on micro targets, i.e. when '--device micro'."
            )
    try:
        tvmc_package = TVMCPackage(package_path=path)
    except IsADirectoryError:
        raise TVMCException(f"File {path} must be an archive, not a directory.")
    except FileNotFoundError:
        raise TVMCException(f"File {path} does not exist.")
    except ReadError:
        raise TVMCException(f"Could not read model from archive {path}!")
    rpc_hostname, rpc_port = common.tracker_host_port_from_cli(args.rpc_tracker)
    try:
        inputs = np.load(args.inputs) if args.inputs else {}
    except IOError as ex:
        raise TVMCException("Error loading inputs file: %s" % ex)
    result = run_module(
        tvmc_package,
        args.device,
        hostname=rpc_hostname,
        port=rpc_port,
        rpc_key=args.rpc_key,
        inputs=inputs,
        fill_mode=args.fill_mode,
        repeat=args.repeat,
        number=args.number,
        profile=args.profile,
        options=options,
    )
    if args.print_time:
        stat_table = result.format_times()
        print(stat_table)
    if args.print_top:
        top_results = get_top_results(result, args.print_top)
        print(top_results)
    if args.outputs:
        result.save(args.outputs)
def drive_run ( args ) : path = pathlib . Path ( args . PATH ) options = None if args . device == "micro" : path = path / "model.tar" if not path . is_file ( ) : TVMCException ( f"Could not find model (model.tar) in the specified project dir {path.dirname()}." ) if args . rpc_key or args . rpc_tracker : raise TVMCException ( "--rpc-key and/or --rpc-tracker can't be specified for micro targets." ) if args . device != "micro" : raise TVMCException ( f"Device '{args.device}' not supported. " "Only device 'micro' is supported to run a model in MLF, " "i.e. when '--device micro'." ) if args . profile : raise TVMCException ( "--profile is not currently supported for micro devices." ) if args . print_time : raise TVMCException ( "--print-time is not currently supported for micro devices." ) options = get_and_check_options ( args . project_option , args . valid_options ) else : if args . list_options : raise TVMCException ( "--list-options is only availabe on micro targets, i.e. when '--device micro'." ) try : tvmc_package = TVMCPackage ( package_path = path ) except IsADirectoryError : raise TVMCException ( f"File {path} must be an archive, not a directory." ) except FileNotFoundError : raise TVMCException ( f"File {path} does not exist." ) except ReadError : raise TVMCException ( f"Could not read model from archive {path}!" ) rpc_hostname , rpc_port = common . tracker_host_port_from_cli ( args . rpc_tracker ) try : inputs = np . load ( args . inputs ) if args . inputs else { } except IOError as ex : raise TVMCException ( "Error loading inputs file: %s" % ex ) result = run_module ( tvmc_package , args . device , hostname = rpc_hostname , port = rpc_port , rpc_key = args . rpc_key , inputs = inputs , fill_mode = args . fill_mode , repeat = args . repeat , number = args . number , profile = args . profile , options = options , ) if args . print_time : stat_table = result . format_times ( ) print ( stat_table ) if args . print_top : top_results = get_top_results ( result , args . print_top ) print ( top_results ) if args . outputs : result . save ( args . outputs )
Invoke runner module with command line arguments
Parameters
Invoke runner module with command line arguments Parameters
"""Invoke runner module with command line arguments

    Parameters
    ----------
    args: argparse.Namespace
        Arguments from command line parser.
    """ # Check for options unavailable for micro targets. # Get and check options for micro targets. # Check for options only availabe for micro targets. # print here is intentional # print here is intentional # Save the outputs
args