SmallHedgehog opened a new issue #6266:
URL: https://github.com/apache/incubator-tvm/issues/6266


   # using module.time_evaluator
   `
   print("Evaluate inference time cost...")
   ftimer = module.module.time_evaluator("run", ctx, number=1, repeat=600)
   prof_res = np.array(ftimer().results) * 1000  # convert to millisecond
   print("Mean inference time (std dev): %.2f ms (%.2f ms)" 
%(np.mean(prof_res), np.std(prof_res)))
   `
   # 27.6ms
   
   # using myself method
   `
     with tvm.target.cuda():
            with autotvm.apply_history_best(log_file):
                print("Compile...")
                with relay.build_config(opt_level=3):
                    graph, lib, params = relay.build(mod, 'cuda', 'llvm', 
params=params)
                tvm_model = graph_runtime.create(graph, lib, ctx)
                tvm_model.set_input(**params)
                tvm_model.set_input(input_name, tvm.nd.array(image))
                
                times = 0.0
                for i in range(600):
                    s = time.time()
                    tvm_model.run()
                    pred = tvm_model.get_output(0).asnumpy()
                    tvm_out = pred[0]
                    times += time.time() - s
                print(times / 600)
   `
   # about 72ms


----------------------------------------------------------------
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:
[email protected]


Reply via email to