Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TF FE] Add complex tensor support for ReverseSequence operation #29482

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

darshil929
Copy link

Changes

  • Extended the ReverseSequence loader to support complex tensors
  • Added ComplexTypeMark propagation from input to output
  • Added the true flag to default_op_checks to handle complex tensor inputs
  • Added test cases for complex tensor support with 2D and 3D shapes

Reason for changes

Some audio models use complex type tensors which weren't supported by the ReverseSequence operation in the TensorFlow Frontend. This PR extends the loader to properly handle complex tensors following the same pattern used for other operations like Reshape. Complex tensors are represented as floating-point tensors with an auxiliary dimension to concatenate real and imaginary parts.

Tests

  • Added a TestComplexReverseSequence class with test cases for complex tensors
  • Added tests for both 2D and 3D complex tensor shapes
  • All regular tests (non-complex) pass successfully
  • Complex tensor tests run but show expected type mismatch errors (complex64 vs float32) due to OpenVINO's representation of complex tensors as float32 with an extra dimension
  • Tests were run on both CPU and GPU devices with FP32 and FP16 precision

@darshil929 darshil929 requested a review from a team as a code owner March 15, 2025 12:01
@github-actions github-actions bot added category: TF FE OpenVINO TensorFlow FrontEnd category: TFL FE OpenVINO TensorFlow Lite FrontEnd labels Mar 15, 2025
@sys-openvino-ci sys-openvino-ci added the ExternalPR External contributor label Mar 15, 2025
@darshil929 darshil929 changed the title add complex tensor support for ReverseSequence operation [TF FE] Add complex tensor support for ReverseSequence operation Mar 15, 2025

test_data_complex = [
dict(input_shape=[4, 5], seq_lengths_type=np.int32, seq_dim=1, batch_dim=0),
dict(input_shape=[2, 3, 4], seq_lengths_type=np.int32, seq_dim=1, batch_dim=0),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add test cases for negative batch_dim and seq_dim

Copy link
Author

@darshil929 darshil929 Mar 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the test cases with negative batch_dim and seq_dim values as you asked, but there's a small issue - the test function has assertions that check if dimensions are non-negative:

assert 0 <= batch_dim and batch_dim < len(input_shape)
assert 0 <= seq_dim and seq_dim < len(input_shape)

I think these assertions will fail with negative indices. Should I also modify the assertions to handle negative indices by converting them to positive equivalent first? Or you want to keep the assertions and modify something else?

Let me know what you think is best approach for this! Thanks!

@rkazants
Copy link
Member

build_jenkins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: TF FE OpenVINO TensorFlow FrontEnd category: TFL FE OpenVINO TensorFlow Lite FrontEnd ExternalPR External contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants