UnsupportedGatherLayerError in op Gather_166

Hello

I created a new variant of yolo that i call yolov5n-zoom that is based on yolov5n network. I added kind of some attention modules on it. So I managed to generate an onnx from the export of the yolov5 hailo training docker file. But when I tried re compile I get this error

 hailomz compile --ckpt ../shared_with_docker/yolov5n-zoom/best.onnx --calib-path ../shared_with_docker/dataset-v039/images/train/ --yaml hailo_model_zoo/hailo_mode
l_zoo/cfg/networks/yolov5n_zoom.yaml --classes 2 --hw-arch hailo8l
<Hailo Model Zoo INFO> Start run for network yolov5n_zoom ...
<Hailo Model Zoo INFO> Initializing the hailo8l runner...
[info] Translation started on ONNX model yolov5n_zoom
[info] Restored ONNX model yolov5n_zoom (completion time: 00:00:00.05)
[info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:00.38)
[info] Simplified ONNX model for a parsing retry attempt (completion time: 00:00:01.38)
Traceback (most recent call last):
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 220, in translate_onnx_model
    parsing_results = self._parse_onnx_model_to_hn(
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 300, in _parse_onnx_model_to_hn
    return self.parse_model_to_hn(
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 351, in parse_model_to_hn
    fuser = HailoNNFuser(converter.convert_model(), net_name, converter.end_node_names)
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/translator.py", line 79, in convert_model
    self._create_layers()
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 34, in _create_layers
    self._add_direct_layers()
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 187, in _add_direct_layers
    raise ParsingWithRecommendationException(
hailo_sdk_client.model_translator.exceptions.ParsingWithRecommendationException: Parsing failed. The errors found in the graph are:
 UnsupportedGatherLayerError in op Gather_166: Can't find index
 UnsupportedGatherLayerError in op Gather_167: Can't find index
 UnexpectedNodeError in op Unsqueeze_127: Unexpected node Unsqueeze_127 (Unsqueeze)
 UnsupportedShuffleLayerError in op Transpose_168: Failed to determine type of layer to create in node Transpose_168
 UnsupportedShuffleLayerError in op Reshape_169: Failed to determine type of layer to create in node Reshape_169
 UnsupportedShuffleLayerError in op Reshape_174: Failed to determine type of layer to create in node Reshape_174
 UnsupportedShuffleLayerError in op Reshape_181: Failed to determine type of layer to create in node Reshape_181
Please try to parse the model again, using these end node names: LeakyRelu_17, Pad_165, LeakyRelu_38, LeakyRelu_64, Add_142, Reshape_126

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/local/workspace/hailo_virtualenv/bin/hailomz", line 33, in <module>
    sys.exit(load_entry_point('hailo-model-zoo', 'console_scripts', 'hailomz')())
  File "/local/workspace/hailo_model_zoo/hailo_model_zoo/main.py", line 122, in main
    run(args)
  File "/local/workspace/hailo_model_zoo/hailo_model_zoo/main.py", line 111, in run
    return handlers[args.command](args)
  File "/local/workspace/hailo_model_zoo/hailo_model_zoo/main_driver.py", line 250, in compile
    _ensure_optimized(runner, logger, args, network_info)
  File "/local/workspace/hailo_model_zoo/hailo_model_zoo/main_driver.py", line 73, in _ensure_optimized
    _ensure_parsed(runner, logger, network_info, args)
  File "/local/workspace/hailo_model_zoo/hailo_model_zoo/main_driver.py", line 108, in _ensure_parsed
    parse_model(runner, network_info, ckpt_path=args.ckpt_path, results_dir=args.results_dir, logger=logger)
  File "/local/workspace/hailo_model_zoo/hailo_model_zoo/core/main_utils.py", line 97, in parse_model
    model_name = translate_model(runner, network_info, ckpt_path, tensor_shapes=start_node_shapes)
  File "/local/workspace/hailo_model_zoo/hailo_model_zoo/utils/parse_utils.py", line 28, in translate_model
    runner.translate_onnx_model(
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_common/states/states.py", line 16, in wrapped_func
    return func(self, *args, **kwargs)
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/runner/client_runner.py", line 1158, in translate_onnx_model
    parser.translate_onnx_model(
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 260, in translate_onnx_model
    parsing_results = self._parse_onnx_model_to_hn(
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 300, in _parse_onnx_model_to_hn
    return self.parse_model_to_hn(
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 351, in parse_model_to_hn
    fuser = HailoNNFuser(converter.convert_model(), net_name, converter.end_node_names)
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/translator.py", line 79, in convert_model
    self._create_layers()
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 34, in _create_layers
    self._add_direct_layers()
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 111, in _add_direct_layers
    self._layer_callback_from_vertex(vertex)
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 398, in _layer_callback_from_vertex
    consumed_vertices = self._create_slice_layer(vertex)
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 1610, in _create_slice_layer
    h_slice, w_slice, f_slice, consumed_vertices = vertex.get_gather_slice_info()
  File "/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py", line 3470, in get_gather_slice_info
    h_slice = [index[0], index[0] + 1] if single_dim else [index[0], index[1]]
TypeError: can only concatenate list (not "int") to list```
I believe he can't convert some ops. But if it is the case, is there any framework to add these ops in the hailo library?

Best

Did you try the suggestion from the parser?

Frameworks like Pytorch have not been developed specifically for AI accelerators but for CPUs and GPUs. They can describe operators that should not be executed on the accelerator. These operators need to be implemented on the host.
They are often at the beginning and the end of the network. For some popular models we provide the post processing (see our examples and documentation) For your own networks you will need to implement the functionality yourself e.g. using C/C++ or Python.