[Common] Unique decomposition: fix the single element case (#13918)
Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com> Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
This commit is contained in:
@@ -69,6 +69,27 @@ ov::pass::UniqueDecomposition::UniqueDecomposition() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// in case the input with the single input, there is no transformation required
|
||||
// this separate pass needed since now there is no handler for empty tensors
|
||||
// that should be converted to empty Constant nodes
|
||||
// x is already of rank equal to 1 after Reshape
|
||||
auto x_shape = x->get_input_partial_shape(0);
|
||||
if (x_shape[0].is_static() && x_shape[0] == 1) {
|
||||
if (!unique_node->get_output_target_inputs(0).empty()) {
|
||||
x->set_friendly_name(unique_node->get_friendly_name() + ".0");
|
||||
unique_node->output(0).replace(x->output(0));
|
||||
}
|
||||
|
||||
if (!unique_node->get_output_target_inputs(2).empty()) {
|
||||
auto zero_const = rg.make<Constant>(output_indices_type, Shape{1}, 0);
|
||||
zero_const->set_friendly_name(unique_node->get_friendly_name() + ".2");
|
||||
unique_node->output(2).replace(zero_const->output(0));
|
||||
}
|
||||
|
||||
copy_runtime_info(unique_node, rg.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
// denote a number of elements in x as n
|
||||
auto n = get_elements_number_1d(x, element::i32, rg);
|
||||
|
||||
|
||||
@@ -30,8 +30,7 @@ class TestUnique(CommonTFLayerTest):
|
||||
return tf_net, None
|
||||
|
||||
test_data_basic = [
|
||||
pytest.param(dict(x_shape=[1], data_type=tf.float32, out_idx=tf.int32),
|
||||
marks=pytest.mark.xfail(reason="95824")),
|
||||
dict(x_shape=[1], data_type=tf.float32, out_idx=tf.int32),
|
||||
dict(x_shape=[50], data_type=tf.float32, out_idx=tf.int32),
|
||||
dict(x_shape=[100], data_type=tf.float32, out_idx=tf.int64),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user