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

[Good First Issue][TF FE] Support Conj operation for TensorFlow models #21462

Closed
rkazants opened this issue Dec 5, 2023 · 9 comments · Fixed by #21947
Closed

[Good First Issue][TF FE] Support Conj operation for TensorFlow models #21462

rkazants opened this issue Dec 5, 2023 · 9 comments · Fixed by #21947
Assignees
Labels
category: TF FE OpenVINO TensorFlow FrontEnd good first issue Good for newcomers no_stale Do not mark as stale
Milestone

Comments

@rkazants
Copy link
Contributor

rkazants commented Dec 5, 2023

Context

OpenVINO component responsible for support of TensorFlow models is called as TensorFlow Frontend (TF FE). TF FE converts a model represented in TensorFlow opset to a model in OpenVINO opset.

In order to infer TensorFlow models with Conj operation by OpenVINO, TF FE needs to be extended with this operation support.

What needs to be done?

For Conj operation support, you need to add the corresponding loader into TF FE op directory and to register it into the dictionary of Loaders. One loader is responsible for conversion (or decomposition) of one type of TensorFlow operation.

Here is an example of loader implementation for TensorFlow Einsum operation:

OutputVector translate_einsum_op(const NodeContext& node) { 
     auto op_type = node.get_op_type(); 
     TENSORFLOW_OP_VALIDATION(node, op_type == "Einsum", "Internal error: incorrect usage of translate_einsum_op."); 
     auto equation = node.get_attribute<std::string>("equation"); 
  
     OutputVector inputs; 
     for (size_t input_ind = 0; input_ind < node.get_input_size(); ++input_ind) { 
         inputs.push_back(node.get_input(input_ind)); 
     } 
  
     auto einsum = make_shared<Einsum>(inputs, equation); 
     set_node_name(node.get_name(), einsum); 
     return {einsum}; 
 } 

In this example, translate_einsum_op converts TF Einsum into OV Einsum. NodeContext object passed into the loader packs all info about inputs and attributes of Einsum operation. The loader retrieves an attribute of the equation by using the NodeContext::get_attribute() method, prepares input vector, creates Einsum operation from OV opset and returns a vector of outputs.

Responsibility of a loader is to parse operation attributes, prepare inputs and express TF operation via OV operations sub-graph. Example for Einsum demonstrates the resulted sub-graph with one operation. In PR #19007 you can see operation decomposition into multiple node sub-graph.

Hint

OpenVINO does not support directly complex tensors. For supporting this, we use ComplexTypeMark that loader for Conj should propagate forward by representing complex tensor as floating-point tensor having additional dimension in the tail to contain real and imaginary parts. See examples of support complex tensors by ComplexAbs loader from #20860.

Example Pull Requests

Resources

Contact points

@openvinotoolkit/openvino-tf-frontend-maintainers

@rkazants rkazants added good first issue Good for newcomers no_stale Do not mark as stale labels Dec 5, 2023
@rkazants rkazants moved this to Contributors Needed in Good first issues Dec 5, 2023
@rkazants rkazants added the category: TF FE OpenVINO TensorFlow FrontEnd label Dec 5, 2023
@jvr0123
Copy link
Contributor

jvr0123 commented Dec 5, 2023

.take

Copy link
Contributor

github-actions bot commented Dec 5, 2023

Thank you for looking into this issue! Please let us know if you have any questions or require any help.

@ilya-lavrenov ilya-lavrenov moved this from Contributors Needed to Assigned in Good first issues Dec 6, 2023
@p-wysocki
Copy link
Contributor

Hello @rupeshs! Do you have any questions or require any help?

Just yesterday our CONTRIBUTING.md has been updated with a technical guide - I highly recommend checking it out. :)

@rkazants
Copy link
Contributor Author

Hi @jvr0123,

do you have any update on this task?

Best regards,
Roman

@jvr0123
Copy link
Contributor

jvr0123 commented Dec 28, 2023

Hi @rkazants,

Will have a pull request by the weekend. Was having some issues with the testing framework that I think I have mostly figured out.

@rkazants
Copy link
Contributor Author

Hi @jvr0123, please use this PR #21586 as a reference. ConjugateTranspose is quite similar to Conj.

@rkazants
Copy link
Contributor Author

rkazants commented Jan 2, 2024

Hi @jvr0123, is there any update on this task? Please use PR #21586 it should simplify your task;)

Best regards,
Roman

@p-wysocki
Copy link
Contributor

I am happy to announce that we have created a channel dedicated to Good First Issues support on our Intel DevHub Discord server! Join it to receive support, engage in discussions, ask questions and talk to OpenVINO developers.

@jvr0123
Copy link
Contributor

jvr0123 commented Jan 3, 2024

Hello, extreme apologies for the wait. I have just created a draft pull request. Thanks for linking the other PR, was extremely helpful!

@rkazants rkazants changed the title [Good First Issue]: Support Conj operation for TensorFlow models [Good First Issue][TF FE] Support Conj operation for TensorFlow models Jan 17, 2024
@mlukasze mlukasze moved this from Assigned to In Review in Good first issues Jan 25, 2024
@ilya-lavrenov ilya-lavrenov moved this from Assigned to Under Review in OpenVINO General Board Jan 31, 2024
@github-project-automation github-project-automation bot moved this from In Review to Closed in Good first issues Jan 31, 2024
@rkazants rkazants moved this from Under Review to Closed in OpenVINO General Board Jan 31, 2024
@mlukasze mlukasze added this to the 2024.0 milestone Feb 1, 2024
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 good first issue Good for newcomers no_stale Do not mark as stale
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants