openvino icon indicating copy to clipboard operation
openvino copied to clipboard

[Good First Issue][TFL FE]: Support GELU operation for TensorFlow Lite

Open e-nugmanova opened this issue 1 year ago • 2 comments

Context

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

TensorFlow Lite opset is specified via

  • reference implementation: link
  • attributes definition in schema: link

What needs to be done?

For GELU operation support, you need to implement:

OutputVector translate_gelu_op(const NodeContext& node) {
    default_op_checks(node, 1, {"GELU"});
    auto x = node.get_input(0);

    // update these lines for best translation
    auto approximate = node.get_attribute<element::boolean>("approximate");
    auto res = make_shared<v7::Gelu>(x, ...);
    //

    set_node_name(node.get_name(), res);
    return res->outputs();
}
OutputVector gelu(const ov::frontend::tensorflow_lite::NodeContext& node) {
    const auto& decoder = get_decoder(node);
    std::map<std::string, ov::Any> attrs{
        {"approximate", decoder->get_attribute(&GeluOptions::approximate)},
    };
    return attribute_helper(node, attrs, ov::frontend::tensorflow::op::translate_gelu_op);
}
  • register loader into the dictionary of Loaders: header, source.

    • header: TFL_OP_CONVERTER(gelu);
    • source: {"GELU", DEQUANTIZE_INPUTS(gelu)},
  • implement layer test for your solution: link

One loader is responsible for conversion (or decomposition) of one type of TensorFlow Lite operation.

Useful links for TFL GELU support:

Resources

Contact points

@jane-intel

e-nugmanova avatar Feb 20 '24 11:02 e-nugmanova

.take

kartik912 avatar Feb 24 '24 09:02 kartik912

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

github-actions[bot] avatar Feb 24 '24 09:02 github-actions[bot]

.take

koookieee avatar Feb 25 '24 16:02 koookieee

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.

github-actions[bot] avatar Feb 25 '24 16:02 github-actions[bot]

Hi @kartik912,

Please share your update on this task.

Best regards, Roman

rkazants avatar Mar 07 '24 06:03 rkazants

I'm reopening the issue due to current assignee's inactivity.

p-wysocki avatar Mar 12 '24 10:03 p-wysocki

Hi @p-wysocki ! Would love to contribute to this issue. Can you assign it to me?

Shubham-Sahoo avatar Mar 12 '24 10:03 Shubham-Sahoo

so it's yours, have fun :)

mlukasze avatar Mar 12 '24 10:03 mlukasze