VTA graph packing

Hello everyone, I’m new to VTA and I’ve recently been studying this sample example : Deploy Pretrained Vision Model from MxNet on VTA. I tried to replace the Resnet18 network with Unet and I was able to successfully import and convert the onnx model from Unet to relay, but I had a problem with the graph_pack. My settings are as follows. setting

When I run the code, I get the following error

Traceback (most recent call last): File “/home/dengbw/PycharmProjects/Unet/test2.py”, line 145, in device_annot=(env.TARGET == “intelfocl”), File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 606, in graph_pack expr = get_subgraph(expr, start_name, stop_name, start_name_idx, stop_name_idx, count_meta) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 531, in get_subgraph annotated = _recursion(anf, False, False, operator_current_idx) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 494, in _recursion _recursion(anf.body, start_found, stop_found, operator_current_idx), File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 517, in _recursion _recursion(anf.body, start_found, stop_found, operator_current_idx), File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 517, in _recursion _recursion(anf.body, start_found, stop_found, operator_current_idx), File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 517, in _recursion _recursion(anf.body, start_found, stop_found, operator_current_idx), [Previous line repeated 341 more times] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 527, in _recursion assert start_found AssertionError

I want to know how to set the start and end points of graph_pack for different networks.

This problem sounds interesting.

same problem; you can dump relay ir, sometimes relay ir index same as the graph packing idx

Thanks for your reply. I use the relay ir index to substitute previous setting. But I get another error as below

Traceback (most recent call last): File “untitled.py”, line 87, in device_annot=(env.TARGET == “intelfocl”), File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 609, in graph_pack expr = packer.visit(expr) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 46, in visit res = self.visit_function(expr) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 206, in visit_function new_body = self.visit(fn.body) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 60, in visit res = self.visit_tuple_getitem(expr) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 233, in visit_tuple_getitem tuple_value = self.visit(op.tuple_value) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 60, in visit res = self.visit_tuple_getitem(expr) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 233, in visit_tuple_getitem tuple_value = self.visit(op.tuple_value) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 58, in visit res = self.visit_tuple(expr) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 230, in visit_tuple return Tuple([self.visit(field) for field in tup.fields], tup.span) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 230, in return Tuple([self.visit(field) for field in tup.fields], tup.span) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 60, in visit res = self.visit_tuple_getitem(expr) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 233, in visit_tuple_getitem tuple_value = self.visit(op.tuple_value) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 60, in visit res = self.visit_tuple_getitem(expr) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 233, in visit_tuple_getitem tuple_value = self.visit(op.tuple_value) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 58, in visit res = self.visit_tuple(expr) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 230, in visit_tuple return Tuple([self.visit(field) for field in tup.fields], tup.span) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 230, in return Tuple([self.visit(field) for field in tup.fields], tup.span) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 60, in visit res = self.visit_tuple_getitem(expr) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 233, in visit_tuple_getitem tuple_value = self.visit(op.tuple_value) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 60, in visit res = self.visit_tuple_getitem(expr) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 233, in visit_tuple_getitem tuple_value = self.visit(op.tuple_value) File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in visit_call args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 322, in args = [self.visit(arg) for arg in call.args] File “/home/dengbw/tvm/python/tvm/relay/expr_functor.py”, line 48, in visit res = self.visit_call(expr) File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 431, in visit_call self.cfactor, File “/home/dengbw/tvm/vta/python/vta/top/graphpack.py”, line 164, in _pack_const assert len(dshape) == 3 AssertionError

This is my relay ir

My setting like this image