I am trying to understand the compilation process, but I couldn’t look into the code of “topi.nn.conv2d_alter_layout
” that is called inside “alter_conv2d_layout
” function. Please note that the function I’m asking is at the last line.
When I tried to debug, the program jumps from:
- …
- topi.nn.conv2d_alter_layout (tvm/nnvm/python/nnvm/top/nn.py)
- frame not available
- dispatch_func (tvm/python/tvm/target.py)
- …
Questions
- What does the function
topi.nn.conv2d_alter_layout
do? - Where to look into its code? Where does it call to? For information, I’m running with the VTA target.
For reference (tvm/nnvm/python/nnvm/top/nn.py)
@reg.register_alter_op_layout("conv2d")
def alter_conv2d_layout(attrs, inputs, tinfos):
"""Replace conv2d op with other layouts or algorithms"""
import nnvm.symbol as sym
# map relay op names to nnvm op names
sym.contrib_conv2d_winograd_without_weight_transform = \
sym.contrib.conv2d_winograd_without_weight_transform
sym.contrib_conv2d_winograd_weight_transform = \
sym.contrib.conv2d_winograd_weight_transform
sym.nn = sym
# map relay argument names to nnvm argument names
raw_reshape = sym.reshape
def _reshape(*args, **kwargs):
if "newshape" in kwargs:
kwargs['shape'] = kwargs.pop('newshape')
return raw_reshape(*args, **kwargs)
sym.reshape = _reshape
return topi.nn.conv2d_alter_layout(attrs, # <---- source code ?
inputs,
tinfos,
sym)