Hi,
My autotvm.template has the following signature,
@autotvm.template
def convolution(dtype):
and I call the template with the following task,
task = autotvm.task.create(convolution, args=('float32'), target='llvm')
which results in the following error,
Traceback (most recent call last):
File "fp_tvm_tuner.py", line 236, in <module>
driver()
File "fp_tvm_tuner.py", line 202, in driver
task = autotvm.task.create(convolution, args=('float32'), target='llvm')
File "/homes/tharindu/tvm/python/tvm/autotvm/task/task.py", line 175, in create
sch, _ = func(*args)
File "<decorator-gen-128>", line 2, in config_dispatcher
File "/homes/tharindu/tvm/python/tvm/autotvm/task/dispatcher.py", line 157, in dispatch_func
return dispatch_dict[cfg.template_key](cfg, *args, **kwargs)
File "/homes/tharindu/tvm/python/tvm/autotvm/task/task.py", line 277, in template_call
return func(*args, **kwargs)
TypeError: convolution() takes 1 positional argument but 7 were given
It looks like ‘float32’ is read as 7 arguments (each character as an argument, i.e., if I pass ‘float322’, it will read 8 arguments) instead of a single string. Has anyone noticed this behavior before?
Also, I would like to know how to handle a template that doesn’t take any arguments. What should be the value of args
to the autotvm.task.create
function in that case? Documentation specifies args as a List object but apparently an empty list/iterable (i.e, args = []
or args=()
) again throws the following error.
Traceback (most recent call last):
File "fp_tvm_tuner.py", line 236, in <module>
driver()
File "fp_tvm_tuner.py", line 202, in driver
task = autotvm.task.create(convolution, args=(), target='llvm')
File "/homes/tharindu/tvm-master/python/tvm/autotvm/task/task.py", line 179, in create
ret.flop = ret.config_space.flop or compute_flop(sch)
File "/homes/tharindu/tvm-master/python/tvm/autotvm/task/task.py", line 375, in compute_flop
ret = traverse(sch.outputs)
File "/homes/tharindu/tvm-master/python/tvm/autotvm/task/task.py", line 364, in traverse
ret += num_element * _count_flop(exp)
File "/homes/tharindu/tvm-master/python/tvm/autotvm/task/task.py", line 320, in _count_flop
num_iter = _prod_length(exp.axis)
File "/homes/tharindu/tvm-master/python/tvm/autotvm/task/task.py", line 312, in _prod_length
num_iter = int(np.prod([get_const_int(axis.dom.extent) for axis in axes]))
File "/homes/tharindu/tvm-master/python/tvm/autotvm/task/task.py", line 312, in <listcomp>
num_iter = int(np.prod([get_const_int(axis.dom.extent) for axis in axes]))
File "/homes/tharindu/tvm-master/python/tvm/autotvm/util.py", line 141, in get_const_int
exp = ir_pass.Simplify(expr)
File "/homes/tharindu/tvm-master/python/tvm/_ffi/_ctypes/function.py", line 180, in __call__
values, tcodes, num_args = _make_tvm_args(args, temp_args)
File "/homes/tharindu/tvm-master/python/tvm/_ffi/_ctypes/function.py", line 147, in _make_tvm_args
raise TypeError("Don't know how to handle type %s" % type(arg))
TypeError: Don't know how to handle type <class 'module'>
Thanks,