Graph Packing with VTA and Unet

When I refer to Deploy Pretrained Vision Model from MxNet on VTA,I changed the network to Unet,I want to accelerate the implementation of Unet through PYNQ board. It was fine when you imported the network and finished quantizing, but you encountered an error when you ran graph_pack.My Settings for graph_pack are as follows:

relay_prog = graph_pack(
                mod["main"],
                env.BATCH,
                env.BLOCK_OUT,
                env.WGT_WIDTH,
                start_name="cast",
                stop_name="nn.conv2d",
                start_name_idx =8,
                stop_name_idx = 299 ,
                device_annot=(env.TARGET == "intelfocl"),
            )

The errors encountered are as follows:

An error occurred during the execution of TVM.
For more information, please see: https://tvm.apache.org/docs/errors.html
---------------------------------------------------------------

  Check failed: src_shape.size() == src_axis.size() (6 vs. 4) : 
  File "/home/amax/tvm/python/tvm/_ffi/_cython/base.pxi", line 163, in tvm._ffi._cy3.core.CALL
    raise get_last_ffi_error()
  File "/home/amax/tvm/python/tvm/_ffi/_cython/packed_func.pxi", line 246, in tvm._ffi._cy3.core.FuncCall3
    CALL(TVMFuncCall(chandle, &values[0], &tcodes[0],
  File "/home/amax/tvm/python/tvm/_ffi/_cython/packed_func.pxi", line 257, in tvm._ffi._cy3.core.FuncCall
    FuncCall3(chandle, args, nargs, ret_val, ret_tcode)
  File "/home/amax/tvm/python/tvm/_ffi/_cython/packed_func.pxi", line 323, in tvm._ffi._cy3.core.PackedFuncBase.__call__
    FuncCall(self.chandle, args, &ret_val, &ret_tcode)
  File "/home/amax/tvm/python/tvm/ir/transform.py", line 161, in __call__
    return _ffi_transform_api.RunPass(self, mod)
  File "/home/amax/tvm/vta/python/vta/top/graphpack.py", line 30, in run_opt_pass
    mod = opt_pass(mod)
  File "/home/amax/tvm/vta/python/vta/top/graphpack.py", line 611, in graph_pack
    expr = run_opt_pass(expr, transform.InferType())
  File "/home/amax/zmb/segnet_tvm/deploy_classification.py", line 225, in <module>
    relay_prog = graph_pack(

I don’t know how this happened,since the start_name definition was already after the first conv2D convolution. Has anyone experienced this problem or can you help solve it? I’ve been stuck here for a long time. Thank you.

1 Like

A fast try is to set a non-conv2d operator as the stop with the stop_name and index, if that still not work , I can help you for a debug if you can share your model.

Hello, I have shared the model and the VTA code imported into the model on the web disk,this is link I only changed the import network and graph_pack, not the rest of the test section. I would appreciate it if you could help debug。Since it is the first time for me to contact VTA, this problem has been bothering me for a long time and has not been solved yet. I am looking forward to your help. Thank you.

@hjiang Hello, I have shared the model and the VTA code imported into the model on the web disk,this is link I only changed the import network and graph_pack, not the rest of the test section. I would appreciate it if you could help debug。Since it is the first time for me to contact VTA, this problem has been bothering me for a long time and has not been solved yet. I am looking forward to your help. Thank you.

@hjiang In addition, I would like to ask, can Nn. upsample be implemented in VTA? In the process of running Unet, I suspected that the error was caused by Upsample or CAT. Have you ever implemented this layer? A detailed description can be found in another help I wrote in Can Upsample be implemented on VTA in graph_pack?. Do you have any thoughts or suggestions? Looking forward to your reply. Thank you very much

@MengboZ thanks for share the model, about upsample yes vta support upsample layer, this is the related PR for upsample implementation https://github.com/apache/tvm/pull/4791, if you find any other operator not support you also can try your implementation by refer the said PR, once I get a bandwidth I would help you to figure the said issue asap.

I’ve read the Pr,since it is my first time to use it, I don’t know how to use it. Back to my problem, how do I solve it? How do you try to overcome that? Thank you very much.

Hi, any update on this issue? did you solve this problem?