Hi again,
I am still through the process of learning tvm, and what I want to do now is use a topi convolution (for Mali) and optimize it through the tuner.
This is the code that I am using:
@autotvm.template
def topi_conv(Wi, Hi, C, Ww, Hw, Nw):
X = tvm.placeholder((1, Hi, Wi, C), name='X')
W = tvm.placeholder((Hw, Ww, C, Nw), name='W')
cfg = autotvm.get_config()
print(cfg)
out = topi.mali.conv2d(X, W, (1,1), 'SAME', (1,1), layout='NCHW')
ts = topi.generic.schedule_conv2d_nchw(cfg, [out])
return ts, [X, W, C]
task = autotvm.task.create(topi_conv, args=(N, M, C, n, m, num_filters), target=target, target_host=target_host)
Unfortunately, I am seeing the following error:
Traceback (most recent call last):
File "/local/eclipse/plugins/org.python.pydev.core_6.5.0.201809011628/pysrc/pydevd.py", line 1767, in <module>
main()
File "/local/eclipse/plugins/org.python.pydev.core_6.5.0.201809011628/pysrc/pydevd.py", line 1752, in main
debugger.connect(host, port)
File "/local/eclipse/plugins/org.python.pydev.core_6.5.0.201809011628/pysrc/pydevd.py", line 1108, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
File "/local/eclipse/plugins/org.python.pydev.core_6.5.0.201809011628/pysrc/pydevd.py", line 1115, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "/local/eclipse/plugins/org.python.pydev.core_6.5.0.201809011628/pysrc/_pydev_imps/_pydev_execfile.py", line 25, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/giuros01/tvm_investigation/optimize_convolution_topi.py", line 34, in <module>
task = autotvm.task.create(topi_conv, args=(N, M, C, n, m, num_filters), target=target, target_host=target_host)
File "/home/giuros01/tvm/python/tvm/autotvm/task/task.py", line 191, in create
sch, _ = func(*args)
File "<decorator-gen-293>", line 2, in config_dispatcher
File "/home/giuros01/tvm/python/tvm/autotvm/task/dispatcher.py", line 220, in dispatch_func
return dispatch_dict[cfg.template_key](cfg, *args, **kwargs)
File "/home/giuros01/tvm/python/tvm/autotvm/task/task.py", line 296, in template_call
return func(*args, **kwargs)
File "/home/giuros01/tvm_investigation/optimize_convolution_topi.py", line 28, in topi_conv
out = topi.mali.conv2d(X, W, (1,1), 'SAME', (1,1), layout='NCHW')
File "<decorator-gen-134>", line 2, in conv2d
File "/home/giuros01/tvm/python/tvm/target.py", line 372, in dispatch_func
return dispatch_dict[k](*args, **kwargs)
File "<decorator-gen-281>", line 2, in config_dispatcher
File "/home/giuros01/tvm/python/tvm/autotvm/task/dispatcher.py", line 220, in dispatch_func
return dispatch_dict[cfg.template_key](cfg, *args, **kwargs)
KeyError: ''
I am not sure what I am doing wrong. It looks like the configuration does not get initialized, but I thought it was done automatically. If not, how do I initialize it?
Thank you in advance for any help,
Giuseppe