Skip to content

Commit

Permalink
[TF FE] Fix conversion of TF1 OD models out-of-the-box
Browse files Browse the repository at this point in the history
Signed-off-by: Kazantsev, Roman <[email protected]>
  • Loading branch information
rkazants committed Nov 7, 2023
1 parent c0381ab commit 7a065e3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "openvino/op/if.hpp"
#include "openvino/op/parameter.hpp"
#include "openvino/op/result.hpp"
#include "openvino/op/util/multi_subgraph_base.hpp"
#include "tf_utils.hpp"

using namespace ov;
Expand Down Expand Up @@ -151,6 +152,16 @@ void insert_result_before_merge(const shared_ptr<Merge>& merge_node,
} // namespace

bool pass::SwitchMergeResolver::run_on_model(const shared_ptr<Model>& m) {
// run this transformation recursively since this is a model pass
for (const auto& op : m->get_ordered_ops()) {
auto multisubgraph_op = as_type_ptr<ov::op::util::MultiSubGraphOp>(op);
if (multisubgraph_op) {
for (size_t i = 0; i < multisubgraph_op->get_internal_subgraphs_size(); ++i) {
run_on_model(multisubgraph_op->get_function(static_cast<int>(i)));
}
}
}

// split set of Switch and Merge nodes to clusters
// where each cluster of Switch and Merge nodes will represent
// the single If operation for fusing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace tensorflow {
namespace pass {

bool ConstToResultRemover::run_on_model(const std::shared_ptr<ov::Model>& m) {
// Note: need to perform this transformation only on the main ov::Model graph
// no need to apply it for sub-graphs!
ResultVector results_to_remove;
// look for isolated UnsupportedConst->Result sub-graphs to remove
// also, find isolated Constant->Result sub-graphs to remove
Expand Down

0 comments on commit 7a065e3

Please sign in to comment.