onnx-chainer icon indicating copy to clipboard operation
onnx-chainer copied to clipboard

RNN support for ONNX-Chainer

Open sw005320 opened this issue 7 years ago • 2 comments

I just raised it, as we intensively use RNN (LSTM) for attention-based end-to-end ASR https://github.com/espnet/espnet with chainer and pytorch as a backend, and want to unify these two backends with the ONNX framework to some extent. I really appreciate if you answer when and how it is supported.

sw005320 avatar Jan 19 '18 21:01 sw005320

It's still in an exploratory stage to find a good way to identify an LSTM block from a computational graph dynamically generated. In current Chainer, an LSTM function consists of several Linear functions and activation functions, and it appears as a series of those functions in the resulting computational graph. So, we need to annotate the LSTM part during a forward pass computation, but there's no way to do that now. On the other hand, current ONNX requires the batchsize and the sequence length at the same time to describe a single LSTM operator, but both may change in actual inference programs, so I think the current ONNX is not enough to represent RNN. But we also want to support RNN export into ONNX, so we will continue to try to find a good way. If you have any ideas, we welcome your suggestions of solutions on those problems.

mitmul avatar Jan 31 '18 13:01 mitmul

I see the point. I'm sorry that I don't have a nice solution about it right now, but will let you know once I come up with something. Thanks for your answer.

sw005320 avatar Feb 01 '18 20:02 sw005320