Yet-Another-EfficientDet-Pytorch-Convert-ONNX-TVM icon indicating copy to clipboard operation
Yet-Another-EfficientDet-Pytorch-Convert-ONNX-TVM copied to clipboard

Cannot convert to ONNX using pytorch 1.1.0

Open haoranchen1104 opened this issue 5 years ago • 1 comments

Thanks for the great work of your repo. However, it's not working under pytorch1.1.0 and raise RuntimeError.

RuntimeError: Failed to export an ONNX attribute, since it's not constant, please try to make things (e.g., kernel size) static if possible

Using pytorch 1.2.0 I uncommented the two lines in backbone.py and the code is like

        # if you just want to convert to onnx, you can cancel the two lines of comments
        # or, if you want convert to tvm, just return regression and classification
        
        anchors = self.anchors(inputs, inputs.dtype)
        return features, regression, classification, anchors
        
        # return regression, classification

This time, torch.onnx would work, but the print output was strange.

... ...
  %2665 : Float(1, 46917!, 4!) = onnx::Constant[valutdet\Yet-Another-EfficientDet-Pytet\model.py:377:0e=<Tensor>]()                                                                        ssifier[classifier] # G:\COMPETITION\planer\efficientdet\Yet-Anothe
  return (%2353, %2415, %2477, %2539, %2601, %2352, e=<Tensor>]()
%2664, %2665)  

Don't know why there is ! in Float(1, 46917!, 4!) .

haoranchen1104 avatar May 07 '20 04:05 haoranchen1104

@Modrizil Hi,we use Pytorch 1.4.0, maybe you can try this.

murdockhou avatar May 07 '20 09:05 murdockhou