Auto-tuning, Bus error: 10


#1

We use mobilenet at Mac by TVM, then a error occurred.

The code as follow :

import nnvm
import tvm
import argparse
import time
import numpy as np
import cv2
import mxnet as mx

def parse_args():
parser = argparse.ArgumentParser(description=‘Test with SSD networks.’)
parser.add_argument(’–model-dir’, type=str, default=’’,
help=“model dir”)
parser.add_argument(’–images’, type=str, default=’’,
help=‘Test images, use comma to split multiple.’)
parser.add_argument(’–gpus’, type=str, default=‘0’,
help=‘Training with GPUs, you can specify 1,3 for example.’)
parser.add_argument(’–save-dir’, type=str, default=’’,
help=‘save dir’)
args = parser.parse_args()
return args

def transform_image(img_name):
image = cv2.imread(img_name)
image = cv2.resize(image, (512,512))
image = image.reshape((1,512,512,3))
return image

if name == ‘main’:
args = parse_args()
## grab some image if not specified
image_list = [x.strip() for x in args.images.split(’,’) if x.strip()]

## load and trans
sym, arg_params, aux_params = mx.model.load_checkpoint(args.model_dir, 0)
sym, params = nnvm.frontend.from_mxnet(sym, arg_params=arg_params, aux_params=aux_params)
target = "llvm"
dtype_dict = {'data':'float32'}
shape_dict = {'data': (1, 512, 512, 3)}
with nnvm.compiler.build_config(opt_level=3):
    graph, lib, params = nnvm.compiler.build(sym, target, shape_dict, dtype=dtype_dict, params=params)

## upload
ctx_tvm = tvm.cpu(0)
m = tvm.contrib.graph_runtime.create(graph, lib, ctx_tvm)
print('***inout params***')
m.set_input(**params)

for image in image_list:
    img = transform_image(image)
    x = np.array(img, dtype='float32')
    print('**input data**')
    m.set_input('data', tvm.nd.array(x))
    #print("Evaluate inference time cost...")
    time1 = time.time()
    m.run()
    print('time is:', time.time()-time1)
    tvm_output = m.get_output(0)

At m.run(), the error as follow:

demo_cls_at_mac.sh: line 1: 64038 Bus error: 10 python demo_cls_at_mac.py --model-dir /Users/air/source/gluon-cv/scripts/deployment/export/mobilenetv2_1.0 --images /Users/air/work/det/tools/model_params_json/ssd_512_mobilenetv2_1/97.jpg --save-dir /Users/air/work/det/tools/model_params_json


#2

Seems like the same error as this one.


#3

Hardware: Mac i7 8GB

The input shape is 224x224x3

In auto-tuning, the ResNet18-v1 is run correctly. However, the ResNet50-v1 can not run.

The error is same as above.