You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[TorchOnnxToTorch] Lower ReverseSequence using torch.prim.Loop (#4739)
Updated the ONNX `ReverseSequence` conversion to use a runtime
`torch.prim.Loop` over the batch dimension.
The previous implementation statically unrolled the operation based off
the compile-time batch size, so it failed to apply the operation for
dynamic batch dimensions.
The new implementation obtains the batch size at runtime and iterates
over each batch element using `torch.prim.Loop`. It emits the same set
of operations to reverse the selected portion and can now support both
static and dynamic batch dimensions.
Tests:
- Updated the existing batch-axis and time-axis `ReverseSequence` tests
to check for the new operations
- Added a regression test in `simple_ops_q_to_z.mlir` for a dynamic
batch dimension
0 commit comments