[Good First Issue][TF FE]: Support TensorScatterUpdate operation for TensorFlow
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 TensorScatterUpdate operation by OpenVINO, TF FE needs to be extended with this operation support.
What needs to be done?
For TensorScatterUpdate operation support, you need to implement 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 https://github.com/openvinotoolkit/openvino/pull/19007 you can see operation decomposition into multiple node sub-graph.
Once you are done with implementation of the translator, you need to implement the corresponding layer tests test_tf_MatrixInverse.py and put it into layer_tests/tensorflow_tests directory. Example how to run some layer test:
export TEST_DEVICE=CPU
cd openvino/tests/layer_tests/tensorflow_tests
pytest test_tf_Shape.py
Hint
Check ScatterNDUpdate in OV opset for this support
Example Pull Requests
- https://github.com/openvinotoolkit/openvino/pull/19007
Resources
- What is OpenVINO?
- How to Build OpenVINO
- Developer documentation for TensorFlow Frontend
- Contribution guide - start here!
- Intel DevHub Discord channel - engage in discussions, ask questions and talk to OpenVINO developers
Contact points
- @openvinotoolkit/openvino-tf-frontend-maintainers
- @rkazants in GitHub
- rkazants in Discord
Ticket
No response
.take
Thank you for looking into this issue! Please let us know if you have any questions or require any help.
.take
Thanks for being interested in this issue. It looks like this ticket is already assigned to a contributor. Please communicate with the assigned contributor to confirm the status of the issue.
.take
Thank you for looking into this issue! Please let us know if you have any questions or require any help.
hey @swapna1507 do you need any support? :)
Hello Michal,
Thank you for checking on me. Just got caught up with work and unfortunately I won’t be able to contribute and commit to this as much until September.
Thank you for your understanding, apologies from my end for committing to this and not giving enough.
Regards, Swapna Manikandan
On Thu, 25 Jul 2024 at 10:05 AM Michal Lukaszewski @.***> wrote:
hey @swapna1507 https://github.com/swapna1507 do you need any support? :)
— Reply to this email directly, view it on GitHub https://github.com/openvinotoolkit/openvino/issues/23247#issuecomment-2249528953, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4AJRT3NR4XLBYCUIW7JPYDZOCISVAVCNFSM6AAAAABEE7T35WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBZGUZDQOJVGM . You are receiving this because you were mentioned.Message ID: @.***>
No problem at all, we will be here at September for sure, in case you would like to work with us at this time :)
Perfect! Thank you so much. Will definitely love to!
On Thu, 25 Jul 2024 at 10:30 AM Michal Lukaszewski @.***> wrote:
No problem at all, we will be here at September for sure, in case you would like to work with us at this time :)
— Reply to this email directly, view it on GitHub https://github.com/openvinotoolkit/openvino/issues/23247#issuecomment-2249558157, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4AJRT3WVVDRUZ3WY56JAM3ZOCLPFAVCNFSM6AAAAABEE7T35WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBZGU2TQMJVG4 . You are receiving this because you were mentioned.Message ID: @.***>
.take
Thank you for looking into this issue! Please let us know if you have any questions or require any help.