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

[TFLite FE] Clarify public dev API documentation for TFLite Delegate integration #26688

Merged
merged 5 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,39 @@ class DecoderBase : public ov::frontend::DecoderBase {};
class DecoderBaseOperation : public ov::frontend::tensorflow_lite::DecoderBase {
public:
/// \brief Get input tensor name by index
rkazants marked this conversation as resolved.
Show resolved Hide resolved
/// Operation nodes are connected between each other by tensors.
/// Each tensor must have unique name in a graph.
/// The tensor name uniqueness is provided by developer during GraphIterator construction.
/// This method returns tensor name that comes to this operation node by input index idx
rkazants marked this conversation as resolved.
Show resolved Hide resolved
/// If idx is out-of-range, it throws std::exception inherited exception
virtual std::string get_input_tensor_name(size_t idx) const = 0;

/// \brief Get input tensor type by index
/// If idx is out-of-range, it throws std::exception inherited exception
virtual ov::element::Type get_input_tensor_type(size_t idx) const = 0;

/// \brief Get output tensor name by index
/// Operation nodes are connected between each other by tensors.
/// Each tensor must have unique name in a graph.
/// The tensor name uniqueness is provided by developer during GraphIterator construction.
/// This method returns tensor name that outputs by output index idx from this operation
/// If idx is out-of-range, it throws std::exception inherited exception
virtual std::string get_output_tensor_name(size_t idx) const = 0;

/// \brief Get output tensor type by index
/// If idx is out-of-range, it throws std::exception inherited exception
virtual ov::element::Type get_output_tensor_type(size_t idx) const = 0;

/// \brief Get input tensor info
/// returns TensorInfo by input idx index that corresponds to a tensor
/// (it can correspond to Constant, Parameter or intermediate tensor connecting a producer and this current node)
/// If idx is out-of-range, it throws std::exception inherited exception
virtual TensorMetaInfo get_input_tensor_info(size_t idx) const = 0;

/// \brief Get output tensor info
/// returns TensorInfo by output idx index that corresponds to a tensor
/// (it can correspond to intermediate tensor connecting this current node and a consumer)
/// If idx is out-of-range, it throws std::exception inherited exception
virtual TensorMetaInfo get_output_tensor_info(size_t idx) const = 0;

/// \brief Get a number of outputs
Expand All @@ -59,9 +77,15 @@ class DecoderBaseTensor : public ov::frontend::tensorflow_lite::DecoderBase {
virtual TensorMetaInfo get_tensor_info() const = 0;

/// \brief Get input index for tensor
/// returns index of this input in the list of inputs in the model
/// it must be from 0 to n-1, where n - number of inputs in the model
/// if it is not input, returns -1
virtual int64_t get_input_idx() const = 0;

/// \brief Get output index for tensor
/// returns index of this output in the list of outputs in the model
/// it must be from 0 to m-1, where m - number of outputs in the model
/// if it is not input, returns -1
virtual int64_t get_output_idx() const = 0;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ namespace frontend {
namespace tensorflow_lite {

/// Abstract representation for an input model graph that gives nodes in topologically sorted order
/// It returns decoders for model inputs and outputs (DecoderBaseTensor objects) and for operation nodes
/// (DecoderBaseOperation objects) DecoderBaseOperation objects for operation nodes must be sorted in topological order
/// from producing nodes to consumer nodes when `get_decoder()` is called. DecoderBaseTensor objects for inputs and
/// outputs must be returned first by `get_decoder()` method. Order of DecoderBaseTensor objects for inputs and outputs
/// defines their order in the original model, i.e. model input index and model output index.
/// For example, calling `get_decoder()` during iterating GraphIterator returns
/// DecoderBaseTensor (for input 0), ..., DecoderBaseTensor (for input n-1),
/// DecoderBaseTensor (for output 0), ..., DecoderBaseTensor (for output m-1),
/// DecoderBaseOperation (for op 1), ..., DecoderBaseOperation (for op k),
/// where n - number of inputs in the model, m - number of outputs in the model k - number of operation nodes.
/// NOTE: constants are ignored and no decoder object is returned for constant.
class GraphIterator : ::ov::RuntimeAttribute {
public:
using Ptr = std::shared_ptr<GraphIterator>;
Expand Down
Loading