Skip to content

Instantly share code, notes, and snippets.

@Wheest
Created January 4, 2021 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wheest/385936bc23cfea40ddc930fb10902d0e to your computer and use it in GitHub Desktop.
Save Wheest/385936bc23cfea40ddc930fb10902d0e to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"ExecuteTime": {
"end_time": "2021-01-04T13:39:24.940221Z",
"start_time": "2021-01-04T13:39:24.921838Z"
}
},
"outputs": [],
"source": [
"#!/usr/bin/env python\n",
"\n",
"# -*- encoding=utf-8 -*-\n",
"import keras\n",
"import os\n",
"import tvm\n",
"import tvm.relay as relay\n",
"import numpy as np\n",
"from PIL import Image\n",
"from tvm.contrib import graph_runtime\n",
"from tvm.autotvm.tuner import XGBTuner, GATuner, RandomTuner, GridSearchTuner\n",
"from tvm.autotvm.graph_tuner import DPTuner, PBQPTuner\n",
"from tvm import autotvm\n",
"\n",
"def getTestData(pic_number):\n",
" x_return = []\n",
" pic = Image.open(\"test_pic.png\")\n",
" pic = np.array(pic)\n",
" for i in range(pic_number):\n",
" x_return.append(pic)\n",
" return np.array(x_return)\n",
"\n",
"def compare(graph, lib, params, batch_size):\n",
" x_test = getTestData(batch_size) # load test data\n",
" res_keras = predict_model.predict(x_test)\n",
" \n",
" ctx = tvm.cpu(0)\n",
" output_shape = (batch_size, 1000)\n",
" \n",
" module = graph_runtime.create(graph, lib, ctx)\n",
" test_x_tvm = x_test.transpose([0, 3, 1, 2])\n",
" dtype = 'float32'\n",
" data = test_x_tvm.astype(dtype)\n",
" module.set_input(\"input_1\", data)\n",
" module.set_input(**params)\n",
" module.run()\n",
" res_tvm = module.get_output(0, tvm.nd.empty(output_shape)).asnumpy()\n",
" # ########################### calc tvm accuracy #################################################\n",
"\n",
" np.testing.assert_allclose(res_keras,res_tvm,rtol=1e-5,atol=1e-5)\n",
" print(f'Batch size {batch_size} working')\n",
"\n",
"def load_keras_model():\n",
" print('Loading Keras model')\n",
" predict_model = keras.models.load_model(model_name)\n",
" print('Loaded Keras model')\n",
" return predict_model\n",
" \n",
" \n",
"def load_tvm_model(predict_model, batch_size):\n",
" # ############################ load keras model to relay IRModule ##################################\n",
" input_shape = (batch_size,3,224,224)\n",
" output_shape = (batch_size, 1000)\n",
"\n",
" shape_dict = {\"input_1\": input_shape}\n",
" target = 'llvm -mcpu=core-avx2'\n",
" ctx = tvm.cpu(0)\n",
"\n",
" irmod, params = relay.frontend.from_keras(predict_model, shape_dict)\n",
"\n",
" # ########################## Compile the RelayIR ####################################################\n",
" # with autotvm.apply_graph_best(\"resnet50-imagenet_origin.h5_graph_opt.log\"):\n",
" # with tvm.transform.PassContext(opt_level=3):\n",
" graph, lib, params = relay.build_module.build(\n",
" irmod, target=target, params=params)\n",
" \n",
" return graph, lib, params\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"ExecuteTime": {
"end_time": "2021-01-04T13:34:44.898036Z",
"start_time": "2021-01-04T13:34:42.278820Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Loading Keras model\n",
"Loaded Keras model\n"
]
}
],
"source": [
"model_name = \"resnet50-imagenet_origin.h5\"\n",
"predict_model = load_keras_model()\n"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {
"ExecuteTime": {
"end_time": "2021-01-04T13:43:51.274077Z",
"start_time": "2021-01-04T13:41:25.895196Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('dense_nopack.x86', ('TENSOR', (1, 2048), 'float32'), ('TENSOR', (1000, 2048), 'float32'), None, 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 3, 230, 230), 'float32'), ('TENSOR', (64, 3, 7, 7), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"/home/pez/.virtualenvs/venv20/lib/python3.6/site-packages/ipykernel_launcher.py:65: DeprecationWarning: legacy graph runtime behavior of producing json / lib / params will be removed in the next release. Please see documents of tvm.contrib.graph_runtime.GraphModule for the new recommended usage.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Batch size 1 working\n",
"Batch size 2 working\n",
"Batch size 3 working\n",
"Batch size 4 working\n",
"Batch size 5 working\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('dense_nopack.x86', ('TENSOR', (6, 2048), 'float32'), ('TENSOR', (1000, 2048), 'float32'), None, 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 512, 7, 7), 'float32'), ('TENSOR', (2048, 512, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 512, 7, 7), 'float32'), ('TENSOR', (512, 512, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 2048, 7, 7), 'float32'), ('TENSOR', (512, 2048, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 1024, 14, 14), 'float32'), ('TENSOR', (512, 1024, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 256, 14, 14), 'float32'), ('TENSOR', (1024, 256, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 256, 14, 14), 'float32'), ('TENSOR', (256, 256, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 1024, 14, 14), 'float32'), ('TENSOR', (256, 1024, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 512, 28, 28), 'float32'), ('TENSOR', (256, 512, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 128, 28, 28), 'float32'), ('TENSOR', (512, 128, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 128, 28, 28), 'float32'), ('TENSOR', (128, 128, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 512, 28, 28), 'float32'), ('TENSOR', (128, 512, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 256, 56, 56), 'float32'), ('TENSOR', (128, 256, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 64, 56, 56), 'float32'), ('TENSOR', (256, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 64, 56, 56), 'float32'), ('TENSOR', (64, 64, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 256, 56, 56), 'float32'), ('TENSOR', (64, 256, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 64, 56, 56), 'float32'), ('TENSOR', (64, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 3, 230, 230), 'float32'), ('TENSOR', (64, 3, 7, 7), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 256, 56, 56), 'float32'), ('TENSOR', (512, 256, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 512, 28, 28), 'float32'), ('TENSOR', (1024, 512, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (6, 1024, 14, 14), 'float32'), ('TENSOR', (2048, 1024, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Batch size 6 working\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('dense_nopack.x86', ('TENSOR', (7, 2048), 'float32'), ('TENSOR', (1000, 2048), 'float32'), None, 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 512, 7, 7), 'float32'), ('TENSOR', (2048, 512, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 512, 7, 7), 'float32'), ('TENSOR', (512, 512, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 2048, 7, 7), 'float32'), ('TENSOR', (512, 2048, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 1024, 14, 14), 'float32'), ('TENSOR', (512, 1024, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 256, 14, 14), 'float32'), ('TENSOR', (1024, 256, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 256, 14, 14), 'float32'), ('TENSOR', (256, 256, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 1024, 14, 14), 'float32'), ('TENSOR', (256, 1024, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 512, 28, 28), 'float32'), ('TENSOR', (256, 512, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 128, 28, 28), 'float32'), ('TENSOR', (512, 128, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 128, 28, 28), 'float32'), ('TENSOR', (128, 128, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 512, 28, 28), 'float32'), ('TENSOR', (128, 512, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 256, 56, 56), 'float32'), ('TENSOR', (128, 256, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 64, 56, 56), 'float32'), ('TENSOR', (256, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 64, 56, 56), 'float32'), ('TENSOR', (64, 64, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 256, 56, 56), 'float32'), ('TENSOR', (64, 256, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 64, 56, 56), 'float32'), ('TENSOR', (64, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 3, 230, 230), 'float32'), ('TENSOR', (64, 3, 7, 7), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 256, 56, 56), 'float32'), ('TENSOR', (512, 256, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 512, 28, 28), 'float32'), ('TENSOR', (1024, 512, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (7, 1024, 14, 14), 'float32'), ('TENSOR', (2048, 1024, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Batch size 7 working\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('dense_nopack.x86', ('TENSOR', (8, 2048), 'float32'), ('TENSOR', (1000, 2048), 'float32'), None, 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 512, 7, 7), 'float32'), ('TENSOR', (2048, 512, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 512, 7, 7), 'float32'), ('TENSOR', (512, 512, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 2048, 7, 7), 'float32'), ('TENSOR', (512, 2048, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 1024, 14, 14), 'float32'), ('TENSOR', (512, 1024, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 256, 14, 14), 'float32'), ('TENSOR', (1024, 256, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 256, 14, 14), 'float32'), ('TENSOR', (256, 256, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 1024, 14, 14), 'float32'), ('TENSOR', (256, 1024, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 512, 28, 28), 'float32'), ('TENSOR', (256, 512, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 128, 28, 28), 'float32'), ('TENSOR', (512, 128, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 128, 28, 28), 'float32'), ('TENSOR', (128, 128, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 512, 28, 28), 'float32'), ('TENSOR', (128, 512, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 256, 56, 56), 'float32'), ('TENSOR', (128, 256, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 64, 56, 56), 'float32'), ('TENSOR', (256, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 64, 56, 56), 'float32'), ('TENSOR', (64, 64, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 256, 56, 56), 'float32'), ('TENSOR', (64, 256, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 64, 56, 56), 'float32'), ('TENSOR', (64, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 3, 230, 230), 'float32'), ('TENSOR', (64, 3, 7, 7), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 256, 56, 56), 'float32'), ('TENSOR', (512, 256, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 512, 28, 28), 'float32'), ('TENSOR', (1024, 512, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (8, 1024, 14, 14), 'float32'), ('TENSOR', (2048, 1024, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Batch size 8 working\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('dense_nopack.x86', ('TENSOR', (9, 2048), 'float32'), ('TENSOR', (1000, 2048), 'float32'), None, 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 512, 7, 7), 'float32'), ('TENSOR', (2048, 512, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 512, 7, 7), 'float32'), ('TENSOR', (512, 512, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 2048, 7, 7), 'float32'), ('TENSOR', (512, 2048, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 1024, 14, 14), 'float32'), ('TENSOR', (512, 1024, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 256, 14, 14), 'float32'), ('TENSOR', (1024, 256, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 256, 14, 14), 'float32'), ('TENSOR', (256, 256, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 1024, 14, 14), 'float32'), ('TENSOR', (256, 1024, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 512, 28, 28), 'float32'), ('TENSOR', (256, 512, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 128, 28, 28), 'float32'), ('TENSOR', (512, 128, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 128, 28, 28), 'float32'), ('TENSOR', (128, 128, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 512, 28, 28), 'float32'), ('TENSOR', (128, 512, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 256, 56, 56), 'float32'), ('TENSOR', (128, 256, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 64, 56, 56), 'float32'), ('TENSOR', (256, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 64, 56, 56), 'float32'), ('TENSOR', (64, 64, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 256, 56, 56), 'float32'), ('TENSOR', (64, 256, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 64, 56, 56), 'float32'), ('TENSOR', (64, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 3, 230, 230), 'float32'), ('TENSOR', (64, 3, 7, 7), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 256, 56, 56), 'float32'), ('TENSOR', (512, 256, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 512, 28, 28), 'float32'), ('TENSOR', (1024, 512, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n",
"Cannot find config for target=llvm -keys=cpu -link-params=0 -mcpu=core-avx2, workload=('conv2d_NCHWc.x86', ('TENSOR', (9, 1024, 14, 14), 'float32'), ('TENSOR', (2048, 1024, 1, 1), 'float32'), (2, 2), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Batch size 9 working\n",
"Batch size 10 working\n"
]
}
],
"source": [
"for batch_size in range(1, 11):\n",
" graph, lib, params = load_tvm_model(predict_model, batch_size)\n",
" compare(graph, lib, params, batch_size)\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "venv20",
"language": "python",
"name": "venv20"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
"autoclose": false,
"autocomplete": true,
"bibliofile": "biblio.bib",
"cite_by": "apalike",
"current_citInitial": 1,
"eqLabelWithNumbers": true,
"eqNumInitial": 1,
"hotkeys": {
"equation": "Ctrl-E",
"itemize": "Ctrl-I"
},
"labels_anchors": false,
"latex_user_defs": false,
"report_style_numbering": false,
"user_envs_cfg": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment