Forums - ONNX to DLC error "graph has no buffer"

4 posts / 0 new
Last post
ONNX to DLC error "graph has no buffer"
mihalea.andrei
Join Date: 4 Sep 20
Posts: 4
Posted: Sat, 2020-09-05 16:53

Hello,

So, I have the model defined as below which I am converting to ONNX:

import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.onnx
 
class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
 
    def forward(self, x):
        return x[[1, 2], [2, 3]]
 
 
x = torch.rand(10, 10)
 
model = MyModel()
 
torch.onnx.export(
    model,
    x,
    "test.onnx",
    verbose=True,
    input_names=['input'],
    output_names=['output'],
    opset_version=12
)
The graph resulted is the following:
graph(%input : Float(10:10, 10:1),
      %16 : Long(1:1)):
  %1 : Tensor = onnx::Shape(%input)
  %2 : Tensor = onnx::Constant[value={1}]()
  %3 : Tensor = onnx::Gather[axis=0](%1, %2)
  %4 : Tensor = onnx::Flatten[axis=2](%input)
  %5 : Long(2:1) = onnx::Constant[value= 1  2 [ CPULongType{2} ]]()
  %6 : LongTensor = onnx::Mul(%5, %3)
  %7 : Long(2:1) = onnx::Constant[value= 2  3 [ CPULongType{2} ]]()
  %8 : LongTensor = onnx::Add(%7, %6)
  %9 : Tensor = onnx::Gather[axis=0](%4, %8)
  %10 : Tensor = onnx::Shape(%8)
  %13 : Tensor = onnx::Reshape(%9, %16)
  %14 : Tensor = onnx::Concat[axis=0](%10)
  %output : Float(2:1) = onnx::Reshape(%13, %14) # onnx_test.py:56:0
  return (%output)
 

However, when I am using snpe-onnx-to-dlc to convert the model, I get the following error:

Traceback (most recent call last):
  File "path-to/snpe-1.41.0.2173/lib/python/qti/aisw/converters/onnx/onnx_to_ir.py", line 140, in convert
    self.graph)
  File "path-to/snpe-1.41.0.2173/lib/python/qti/aisw/converters/common/converter_ir/translation.py", line 51, in apply_method_to_op
    return translation.apply_method(method_name, *args)
  File "path-to/snpe-1.41.0.2173/lib/python/qti/aisw/converters/common/converter_ir/translation.py", line 17, in apply_method
    return self.indexed_methods[method_name](*args)
  File "path-to/snpe-1.41.0.2173/lib/python/qti/aisw/converters/onnx/data_translations.py", line 204, in add_op
    graph.add(ops[-1], input_names, output_names)
  File "path-to/snpe-1.41.0.2173/lib/python/qti/aisw/converters/common/converter_ir/op_graph.py", line 332, in add
    raise KeyError("Graph has no buffer %s, referred to as input for %s" % (name, op.name))
KeyError: 'Graph has no buffer 1, referred to as input for Gather_2'
2020-09-06 02:40:14,234 - 166 - ERROR - Node Gather_2: 'Graph has no buffer 1, referred to as input for Gather_2'
I am using snpe 1.41.0 and onnx 1.7.0
Any ideas why does this happen?
  • Up2
  • Down0
ljunbit
Join Date: 26 Oct 20
Posts: 1
Posted: Thu, 2020-10-29 20:50

This code will pass if seting  "return x[[1, 2], [2, 3]]" to "return x". Therefore, maybe the index op is not supported in snpe.

  • Up0
  • Down0
shukshiv
Join Date: 28 Apr 21
Posts: 1
Posted: Wed, 2021-04-28 22:05

I am also facing the same issue "graph ha s no buffer 1362 , referrred to as input for concat_275" while converting onnx model to quantized moodel using qnn-onnx converter. If anyone knows the solution, please comment.

  • Up0
  • Down0
892586882
Join Date: 28 Mar 21
Posts: 3
Posted: Thu, 2021-06-24 19:18

any has solutions? i have same error when convert with udo cfgs, i have no idea

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