Forums - ONNX TopK operator cannot be converted to DLC

6 posts / 0 new
Last post
ONNX TopK operator cannot be converted to DLC
martin.kang
Join Date: 23 Feb 22
Posts: 1
Posted: Mon, 2022-04-18 01:52

Hi,

 

I tried to convert an ONNX model with TopK operation.

According to the SNPE docs, the TopK operation seems to be supported at opset version 1, 10, 11

So, I'm using opset version 11

 

But snpe-onnx-to-dlc failed to convert the onnx model. Error messages are following:

Encountered Error: 'ERROR_METHOD_NOT_FOUND_FOR_OP_TYPE: Method add_op_to_backend not found for op_type topk'
 
Stack Trace:
Traceback (most recent call last):
  File "./snpe-onnx-to-dlc", line 53, in <module>
    backend.save(optimized_graph)
  File "/util/snpe-1.61.0/lib/python/qti/aisw/converters/backend/ir_to_dlc.py", line 151, in save
    DlcTranslations.apply_method_to_all_ops(BackendTranslationBase.ADD_OP_TO_BACKEND, graph, self)
  File "/util/snpe-1.61.0/lib/python/qti/aisw/converters/common/converter_ir/translation.py", line 75, in apply_method_to_all_ops
    (method_name, node.op.type))
KeyError: 'ERROR_METHOD_NOT_FOUND_FOR_OP_TYPE: Method add_op_to_backend not found for op_type topk'
 

I need to be using TopK for reduce bbox, before NMS..

 

Are there any workaround? Or SNPE cannot handle TopK operation yet?

  • Up0
  • Down0
bjkim
Join Date: 28 Jul 21
Posts: 1
Posted: Tue, 2022-04-19 00:20

I have same problem.

The guide page shows "topk" is supported but not working with the same error log. (https://developer.qualcomm.com/sites/default/files/docs/snpe/supported_o...)

I don't understand why it does not work on onnx version 11.

  • Up0
  • Down0
bernicerossen
Join Date: 27 Apr 22
Posts: 10
Posted: Wed, 2022-04-27 11:00

its not working for me as well on onnx version 11.

  • Up0
  • Down0
ruzhongl
Join Date: 7 Jun 21
Posts: 42
Posted: Tue, 2022-05-10 00:47

Yes, topK is not supported. The converter do not register the topK, so, you meet this error.

Normally, topk is at the bottom at the network. A workaround is implement topK in CPU side by youself. In Hexagon V2, topK use a simple logic with scaler cpu. The performance is not good still.

  • Up0
  • Down0
shwnapagal
Join Date: 11 May 22
Posts: 1
Posted: Wed, 2022-05-11 08:43

some time we have to change the DLC before conversion Normally, topk is at the bottom at the network. A workaround is implement topK in CPU side by youself. I face the same issue in fishing equipment and web developers in Dubai forum projects In Hexagon V2, topK use a simple logic with scaler cpu. The performance is not good still.

  •  

 

  • Up0
  • Down0
masakazu.yoshimura
Join Date: 13 Oct 22
Posts: 4
Posted: Tue, 2022-10-18 02:50

Dear official developer,

Any update? 

It's weird that Topk is listed as an available onnix function but no implementation in

snpe-1.66.0.3729/lib/python/qti/aisw/converters/backend/ir_to_dlc.py

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.