tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

How to export Pytorch model with custom op to ONNX and run it in ONNX Runtime

Open flower1s opened this issue 8 months ago • 0 comments

In this path of the project: https://github.com/onnx/tutorials/blob/main/PyTorchCustomOperator/README.md; I attempted to compile onnxruntime according to the specified tutorial, but the following error occurred.

[1] 1169287 -- Configuring done (0.3s) -- Configuring done (0.3s) -- Generating done (0.4s) -- Generating done (0.4s) -- Build files have been written to: /afs/ihep.ac.cn/users/m/miaofeng/miaofeng/runboss/python/onnx_work/pytorchcustomoperater/ort_custom_op/build -- Build files have been written to: /afs/ihep.ac.cn/users/m/miaofeng/miaofeng/runboss/python/onnx_work/pytorchcustomoperater/ort_custom_op/build [ 33%] Building CXX object CMakeFiles/customop.dir/custom_op.cc.o /afs/ihep.ac.cn/users/m/miaofeng/miaofeng/runboss/python/onnx_work/pytorchcustomoperater/ort_custom_op/custom_op.cc:16:22: error: expected initializer before '<' token 16 | void GroupNormKernel<T>::Compute(OrtKernelContext* context) { | ^ make[2]: *** [CMakeFiles/customop.dir/build.make:76: CMakeFiles/customop.dir/custom_op.cc.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/customop.dir/all] Error 2 make: *** [Makefile:91: all] Error 2 [1]+ Done cmake ..

I am unable to solve it personally and hope to receive detailed guidance. Best wishes!

flower1s avatar Apr 29 '25 13:04 flower1s