leandron commented on a change in pull request #6578: URL: https://github.com/apache/incubator-tvm/pull/6578#discussion_r496755746
########## File path: python/tvm/driver/tvmc/runner.py ########## @@ -0,0 +1,450 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +""" +Provides support to run compiled networks both locally and remotely. +""" +import json +import logging +import os +import tarfile +import tempfile + +import numpy as np +import tvm +from tvm import rpc +from tvm.autotvm.measure import request_remote +from tvm.contrib import graph_runtime as runtime +from tvm.contrib.debugger import debug_runtime + +from . import common +from .common import TVMCException +from .main import register_parser + + +# pylint: disable=invalid-name +logger = logging.getLogger("TVMC") + + +@register_parser +def add_run_parser(subparsers): + """ Include parser for 'run' subcommand """ + + parser = subparsers.add_parser("run", help="run a compiled module") + parser.set_defaults(func=drive_run) + + # TODO --device needs to be extended and tested to support other targets, + # like 'cl', 'webgpu', etc (@leandron) + parser.add_argument( + "--device", + choices=["cpu", "gpu"], + default="cpu", + help="target device to run the compiled module", + ) + parser.add_argument( + "--fill-mode", + choices=["zeros", "ones", "random"], + default="zeros", + help="fill all input tensors with values", + ) + parser.add_argument("-i", "--inputs", help="path to the .npz input file") + parser.add_argument("-o", "--outputs", help="path to the .npz output file") + parser.add_argument( + "--print-time", action="store_true", help="record and print the execution time(s)" + ) + parser.add_argument( + "--print-top", + metavar="N", + type=int, + help="print the top n values and indices of the output tensor", + ) + parser.add_argument( + "--profile", action="store_true", help="generate profiling data from the runtime execution" Review comment: Can we detect in Python, whether it is enabled and provide a meaningful error message? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org