@@ -29,7 +29,7 @@ bool fuse_type_to_parameter(const std::shared_ptr<ov::Node>& node,
29
29
bool convert_input_precision);
30
30
31
31
// this function inserts Convert operations to 'data' input and outputs of `node`
32
- // to execute 'node' with the original type.
32
+ // to execute 'node' with the original type. This function supports nodes with single output.
33
33
bool wrap_into_original_type (const std::shared_ptr<ov::Node>& node, const precisions_map& precisions);
34
34
bool store_original_type_as_attribute (const std::shared_ptr<ov::Node>& node, const precisions_map& precisions);
35
35
@@ -622,17 +622,20 @@ bool wrap_into_original_type(const std::shared_ptr<ov::Node>& node, const precis
622
622
623
623
const auto & to = it->second ;
624
624
const auto & from = it->first ;
625
-
626
- auto convert_before = std::make_shared<ov::op::v0::Convert>(node->input_value (0 ), from);
627
- node->input (0 ).replace_source_output (convert_before);
628
- auto consumers = node->output (0 ).get_target_inputs ();
629
- auto convert_after = std::make_shared<ov::op::v0::Convert>(node, to);
630
- for (auto & input : consumers) {
631
- const auto consumer = input.get_node ();
632
- if (ov::is_type<ov::op::v0::Result>(consumer) || ov::is_type<ov::op::v0::Convert>(consumer)) {
633
- continue ;
625
+ if (node->get_input_size ()) {
626
+ auto convert_before = std::make_shared<ov::op::v0::Convert>(node->input_value (0 ), from);
627
+ node->input (0 ).replace_source_output (convert_before);
628
+ }
629
+ if (node->get_output_size () == 1 ) {
630
+ auto consumers = node->output (0 ).get_target_inputs ();
631
+ auto convert_after = std::make_shared<ov::op::v0::Convert>(node, to);
632
+ for (auto & input : consumers) {
633
+ const auto consumer = input.get_node ();
634
+ if (ov::is_type<ov::op::v0::Result>(consumer) || ov::is_type<ov::op::v0::Convert>(consumer)) {
635
+ continue ;
636
+ }
637
+ input.replace_source_output (convert_after);
634
638
}
635
- input.replace_source_output (convert_after);
636
639
}
637
640
638
641
return true ;
0 commit comments