How to define and call the vta cfg in the vta_con2d.py?


#1

Hello!
In the “vta_conv2d.py”, the module “register_topi_schedule” call the the input parameter “cfg” as the following code.

@autotvm.register_topi_compute(topi.nn.conv2d, 'vta', 'direct')
def _declaration_conv2d(cfg,
                        data,
                        kernel,
                        strides,
                        padding,
                        dilation,
                        layout,
                        out_dtype):

But, the code which calling the function “topi.nn.conv2d” don’t pass the parameters “cfg” explicitly, so I want to know how the module “_declaration_conv2d” get the cfg? And how to define my own vta cfg? Is there some explanation of the “cfg” format or usage?


#2

cfg is an autotvm config object - it defines the schedule configuration space: https://github.com/dmlc/tvm/blob/master/python/tvm/autotvm/task/space.py#L579

You can define the space either in the declaration or in the schedule definition; in the case of VTA we define the space axes in _schedule_conv2d

I assume that if your original question is: “I want to change the cfg configuration space” you can edit the code in vta_conv2d.py between ##### space definition begin ##### and ###### space definition end ######


#3

Thanks! It helps a lot