Exporting GRU RNN to ONNX

I’m getting an error RuntimeError: ONNX export failed: Couldn't export operator aten::gru when trying to export to the ONNX format. I compiled from master (latest commit in git log is from Saturday). Googling returns results suggesting that this error means some functionality I’m using isn’t supported (for exporting). I’m just a using very basic one layer GRU though…

I did come across this this, which seems to be the solution to solve my problem. But do you think it’s feasible for someone not that skilled in C++ to accomplish this?

Do you assigned the paramter of the gru unit batch_first=True when you training your net? it should be set to False ,onnx doesnot support if it is True

1 Like

Yes I did have that set to True! Thank you.

But think I will try out the new JIT stuff anyways.

Hello,how is your progress in trying to modify the JIT stuff?

I don’t think it is a long-term solution to solve the convert problem just by modify the batchfirst flag.because the origin pytorch model is not trained by myself.

The new C++ frontend works quite nicely (though I couldn’t manage to compile it for android (my target platform)), just follow the libtorch tutorial.

1 Like