Skip to content

Commit

Permalink
[TFLite FE] Clarify public dev API documentation for TFLite Delegate …
Browse files Browse the repository at this point in the history
…integration (openvinotoolkit#26688)

**Details:** Clarify public dev API documentation for TFLite Delegate
integration. It gives clarity upon important aspects for using TFL FE
API.

**Ticket:** TBD

---------

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
  • Loading branch information
rkazants authored Sep 20, 2024
1 parent ffe347a commit 423ebd2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
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
/// 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
/// 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

0 comments on commit 423ebd2

Please sign in to comment.