Forums - onnx2dlc error:name 'graph' is not defined

2 posts / 0 new
Last post
onnx2dlc error:name 'graph' is not defined
18811348016
Join Date: 9 May 22
Posts: 2
Posted: Fri, 2022-08-12 01:47

snpe version:1.64.0.3605

when I used snpe-onnx-to-dlc, error occur:NameError: name 'graph' is not defined

Traceback (most recent call last):
  File "/xxx/snpe/snpe-1.64.0.3605/lib/python/qti/aisw/converters/onnx/onnx_to_ir.py", line 282, in convert
    self.converter_context)
  File "/xxx/snpe/snpe-1.64.0.3605/lib/python/qti/aisw/converters/common/converter_ir/translation.py", line 51, in apply_method_to_op
    return translation.apply_method(method_name, *args, **kwargs)
  File "/xxx/snpe/snpe-1.64.0.3605/lib/python/qti/aisw/converters/common/converter_ir/translation.py", line 18, in apply_method
    return self.indexed_methods[method_name](*args, **kwargs)
  File "/xxx/snpe/snpe-1.64.0.3605/lib/python/qti/aisw/converters/common/converter_ir/translation.py", line 123, in add_op
    op = self.extract_parameters(src_op, context)
  File "/xxx/snpe/snpe-1.64.0.3605/lib/python/qti/aisw/converters/onnx/math_translations.py", line 396, in extract_parameters
    if not graph.has_buffer(src_op.input[0]):
NameError: name 'graph' is not defined
2022-08-12 16:13:02,043 - 209 - ERROR - Node Identity_0: name 'graph' is not defined
 
I check the code in onnx/math_translations.py, I found:
 
def extract_parameters(self, src_op, converter_context):
        # if the input buffer is not in the graph, that means
        # it is a const input. We replace all const inputs with a
        # const op. Otherwise the identity op is a no-op that
        # gets squashed later.
        if not graph.has_buffer(src_op.input[0]):
            const_input = converter_context.weights.fetch(str(src_op.input[0]))
            converter_context.weights.insert(str(src_op.output[0]), const_input)
            return op_adapter.ConstantOp(src_op.output[0], const_input)
 
        return op_adapter.NoopOp(str(src_op.name))
 
"graph" not defined!
  • Up0
  • Down0
ss.pandiri
Join Date: 29 May 18
Posts: 58
Posted: Fri, 2022-08-19 08:55

hi, can you please share the full command you are using?

  • 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.