Skip to content

[OpenVINO] backend.rnn() produces wrong shapes / dimension errors in Loop body #22435

@goyaladitya05

Description

@goyaladitya05

RNN was previously implemented in #22287, but no tests were enabled. The code was never tested.

backend.rnn() uses loop.set_sliced_input(param, inp, 0, 1, 1, -1, 0) with part_size=1, so OpenVINO feeds each Loop body iteration a slice of shape [1, batch, features]. However, the body model parameter was declared with shape list(pshape)[1:] = [batch, features] ; the time dimension was stripped entirely.

When OpenVINO attaches the sliced input it re-runs shape inference on the body using the actual [1, batch, features] shape, propagating an unexpected leading 1 through all downstream ops. This causes two failure modes:

  • implementation=2 cells (default): ops.split(z, 4, axis=1) tries to split along axis=1 which now holds batch (not 4*units) -> "dimension not divisible by 4" error at runtime.

  • implementation=1 cells: no error, but step outputs have shape [1, batch, units] instead of [batch, units], so get_concatenated_slices along axis=0 produces [time*batch, units] instead of [time, batch, units], corrupting the final output tensor.

Reproducer: Any LSTM or GRU layer with implementation=2 (the default) using the OpenVINO backend.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions