Mismatched types error when compiling CenterNet models

Issue description

Compilation of pretrained GluonCV CenterNet models fails with TypeError “mismatched types”.

Steps to reproduce the issue

  1. Prepare hardware and environment that meet the requirements for TVM
  2. Install MXNet 1.5.1 or 1.6.0, GluonCV 0.7.0, and the latest MKL-DNN library
  3. Build TVM with USE_MKLDNN ON
  4. Download a pretrained CenterNet model center_net_resnet* from GluonCV with gluoncv.model_zoo.get_model()
  5. Convert the model to a TVM Relay graph with tvm.relay.frontend.from_mxnet()
  6. Compile the graph with tvm.relay.build() at opt_level 3

What’s the expected result?

  • Compilation succeeds

What’s the actual result?

  • Compilation fails with the following TypeError:

    File "/usr/tvm/src/tir/ir/expr.cc", line 238
    TypeError: Check failed: a.dtype() == b.dtype(): mismatched types
    

Additional details

  • The offending graph node is a MulNode representing the multiplication of arguments a and b
  • The type of argument a is changed from int32 to int64 by VisitExpr() before it is passed on to various checks in the MulNode implementation
  • One such check requires a and b to have the same type
  • The error is thrown by this check because a is of type int64 whereas b is of type int32
  • If this check is commented out, compilation succeeds and inference may be successfully executed

Suggested solutions

  • Add support for GluonCV CenterNet pretrained models to TVM