Issue: mxnet squeeze and excite block builds failed in opt_level=3


#1

#2

issue copied here to make it more readable.
I am trying to deloy a mxnet block network to arm_cpu by tvm.
with relay.build_config(opt_level=2):
graph, lib, params = relay.build(func, target, params=params,target_host=target_host)

The code runs ok. It fails when opt_level=3. The error outputs as:

WARNING:autotvm:Cannot find config for target=llvm -device=arm_cpu -model=rk3399 -target=aarch64-linux-gnu -mattr=+neon, workload=('conv2d', (1, 72, 1, 1, 'float32'), (18, 72, 1, 1, 'float32'), (1, 1), (0, 0), (1, 1), 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
WARNING:autotvm:Cannot find config for target=llvm -device=arm_cpu -model=rk3399 -target=aarch64-linux-gnu -mattr=+neon, workload=('conv2d', (1, 18, 1, 1, 'float32'), (72, 18, 1, 1, 'float32'), (1, 1), (0, 0), (1, 1), 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Traceback (most recent call last):
File "/home/deep/workssd/arm/tvm_app/deploy_mb3_yolov3_on_rk3399.py", line 230, in
graph, lib, params = relay.build(func, target, params=params,target_host=target_host)
File "/home/deep/workssd/arm/tvm/python/tvm/relay/build_module.py", line 196, in build
params)
File "/home/deep/workssd/arm/tvm/python/tvm/relay/build_module.py", line 107, in build
self._build(func, target, target_host)
File "/home/deep/workssd/arm/tvm/python/tvm/_ffi/_ctypes/function.py", line 209, in call
raise get_last_ffi_error()
ValueError: Traceback (most recent call last):
[bt] (8) /home/deep/workssd/arm/tvm/build/libtvm.so(+0x7211fa) [0x7fddb25d01fa]
[bt] (7) /home/deep/workssd/arm/tvm/build/libtvm.so(+0x55b90e) [0x7fddb240a90e]
[bt] (6) /home/deep/workssd/arm/tvm/build/libtvm.so(+0x519bb3) [0x7fddb23c8bb3]
[bt] (5) /home/deep/workssd/arm/tvm/build/libtvm.so(+0x5156e4) [0x7fddb23c46e4]
[bt] (4) /home/deep/workssd/arm/tvm/build/libtvm.so(+0x72137c) [0x7fddb25d037c]
[bt] (3) /home/deep/workssd/arm/tvm/build/libtvm.so(+0x6e961d) [0x7fddb259861d]
[bt] (2) /home/deep/workssd/arm/tvm/build/libtvm.so(+0x6e48cd) [0x7fddb25938cd]
[bt] (1) /home/deep/workssd/arm/tvm/build/libtvm.so(+0x6e220d) [0x7fddb259120d]
[bt] (0) /home/deep/workssd/arm/tvm/build/libtvm.so(+0x961c2b) [0x7fddb2810c2b]
File "/home/deep/workssd/arm/tvm/python/tvm/_ffi/_ctypes/function.py", line 71, in cfun
rv = local_pyfunc(*pyargs)
File "/home/deep/workssd/arm/tvm/python/tvm/relay/op/nn/_nn.py", line 178, in alter_op_layout_conv2d
return topi.nn.conv2d_alter_layout(attrs, inputs, tinfos, op)
File "</usr/local/lib/python3.6/dist-packages/decorator.py:decorator-gen-21>", line 2, in conv2d_alter_layout
File "/home/deep/workssd/arm/tvm/python/tvm/target.py", line 372, in dispatch_func
return dispatch_dict[k](*args, **kwargs)
File "/home/deep/workssd/arm/tvm/topi/python/topi/arm_cpu/conv2d.py", line 705, in _alter_conv2d_layout_arm
new_attrs["channels"] = inputs[1].checked_type.shape[attrs['kernel_layout'].index('O')]
File "/home/deep/workssd/arm/tvm/python/tvm/relay/expr.py", line 47, in checked_type
raise ValueError("The type checker has not populated"
ValueError: The type checker has not populated the checked_type for this node

the last 2 layer is a squeeze and excitation block ,which squeeze 72 to 18 then restored to 72.
The SEblock code is :
class SEBlock(nn.HybridBlock):
def init(self, in_size, r=4, prefix=None, params=None):
super(SEBlock, self).init(prefix=prefix, params=params)
self.excitation = nn.HybridSequential()
self.excitation.add(nn.Conv2D(in_size//r, kernel_size=1, strides=1, padding=0))
self.excitation.add(nn.Activation(‘relu’))
self.excitation.add(nn.Conv2D(in_size, kernel_size=1, strides=1, padding=0))
self.excitation.add(HardSigmoid())

def hybrid_forward(self, F, x, *args, **kwargs):
y = F.contrib.AdaptiveAvgPooling2D(data=x, output_size=(1, 1))
y = self.excitation(y)
z = F.broadcast_mul(x, y)
return z

So what should it be done to make opt_level=3 work?