glow icon indicating copy to clipboard operation
glow copied to clipboard

Lowering of Recurrent Units with Batch being outer dim

Open ksaurabh-cadence opened this issue 5 years ago • 3 comments

Currently the ONNX definition of LSTM/GRU/RNN define input and output tensors such that batch dimension is NOT the outermost dimension and this is somewhat different than how batch dimension is placed for the rest of the operators- https://github.com/onnx/onnx/blob/master/docs/Operators.md#RNN https://github.com/onnx/onnx/blob/master/docs/Operators.md#LSTM https://github.com/onnx/onnx/blob/master/docs/Operators.md#GRU After lowering this "odd" placement gets inherited by all the lowered nodes too. I would like to introduce an option to perform an alternate lowering where transposes are introduced at the beginning and at the end of LSTM/GRU/RNN so that all the lowered nodes have batch along the outer dimension. Would this be something that might be useful for wider audience? If so I can plan to upstream it.

ksaurabh-cadence avatar Dec 02 '20 16:12 ksaurabh-cadence

@jfix71 @rdzhabarov Can you please share your feedback?

ksaurabh-cadence avatar Dec 09 '20 05:12 ksaurabh-cadence

Hi @ksaurabh-cadence, it sounds like a reasonable plan. I am not sure how many others may be interested, but we'd be happy to review/land it if upstreamed.

jfix71 avatar Dec 14 '20 22:12 jfix71

@jfix71 Thanks I will prepare an MR once ready.

ksaurabh-cadence avatar Dec 16 '20 18:12 ksaurabh-cadence