From 4f3474abf672e3355e07d2e02d0325484add2653 Mon Sep 17 00:00:00 2001 From: Anastasiia Pnevskaia Date: Mon, 19 Feb 2024 14:54:42 +0100 Subject: [PATCH] [TF FE] Set single input tensor names in TF1 formats. (#22503) Description: Change setting of names in TF1 to make single input tensor. Ticket: 129457 Code: * [x] Comments * [x] Code style (PEP8) * [x] Transformation generates reshape-able IR * [x] Transformation preserves original framework node names * [x] Transformation preserves tensor names Validation: * [x] Unit tests * [x] Framework operation tests * [x] Transformation tests Documentation: * [x] Supported frameworks operations list * [x] Guide on how to convert the **public** model * [x] User guide update --------- Co-authored-by: Roman Kazantsev --- .../frontend/tensorflow/graph_iterator.py | 2 +- .../src/openvino/frontend/tensorflow/utils.py | 12 +- src/frontends/tensorflow/src/input_model.cpp | 55 ++++---- .../tensorflow/src/translate_session.cpp | 3 +- .../tests/convert_tricky_models.cpp | 2 +- .../tensorflow_common/src/op/identity.cpp | 10 +- src/frontends/tensorflow_common/src/utils.cpp | 4 - tests/layer_tests/common/layer_test_class.py | 6 +- .../test_mo_convert_complex_params.py | 52 ++++---- .../mo_python_api_tests/test_mo_convert_tf.py | 118 +++++++++++++++++- .../test_complex_params.py | 66 +++++----- .../ovc_python_api_tests/test_tf.py | 84 ++++++++++++- .../tensorflow_tests/test_tf_AddTypes.py | 10 +- .../test_tf_AdjustContrastv2.py | 8 +- .../tensorflow_tests/test_tf_ArgMinMax.py | 6 +- .../tensorflow_tests/test_tf_AssignOps.py | 10 +- .../test_tf_AssignVariableOps.py | 6 +- .../tensorflow_tests/test_tf_Atan2.py | 12 +- .../tensorflow_tests/test_tf_BroadcastArgs.py | 19 ++- .../tensorflow_tests/test_tf_Bucketize.py | 6 +- .../tensorflow_tests/test_tf_CheckNumerics.py | 12 +- .../tensorflow_tests/test_tf_ClipByValue.py | 14 +-- .../tensorflow_tests/test_tf_ComplexFFT.py | 42 +++---- .../tensorflow_tests/test_tf_Conj.py | 12 +- .../test_tf_ConjugateTranspose.py | 18 +-- .../tensorflow_tests/test_tf_CropAndResize.py | 18 +-- .../tensorflow_tests/test_tf_Div.py | 12 +- .../tensorflow_tests/test_tf_DivNoNan.py | 12 +- .../test_tf_DynamicPartition.py | 12 +- .../tensorflow_tests/test_tf_EnsureShape.py | 6 +- .../tensorflow_tests/test_tf_ExpandDims.py | 6 +- .../test_tf_ExtractImagePatches.py | 6 +- .../test_tf_FakeQuantWithMinMaxVars.py | 6 +- .../test_tf_FusedBatchNorm.py | 24 ++-- .../tensorflow_tests/test_tf_Gather.py | 14 +-- .../tensorflow_tests/test_tf_GatherNd.py | 12 +- .../tensorflow_tests/test_tf_If.py | 72 +++++------ .../tensorflow_tests/test_tf_Inv.py | 6 +- .../test_tf_InvertPermutation.py | 6 +- .../tensorflow_tests/test_tf_IsFinite.py | 6 +- .../tensorflow_tests/test_tf_IsInf.py | 6 +- .../tensorflow_tests/test_tf_IsNan.py | 6 +- .../tensorflow_tests/test_tf_ListDiff.py | 12 +- .../tensorflow_tests/test_tf_Log1p.py | 6 +- .../test_tf_LookupTableFind.py | 6 +- .../tensorflow_tests/test_tf_MatrixDiag.py | 6 +- .../test_tf_MaxPoolWithArgmax.py | 6 +- .../tensorflow_tests/test_tf_Mul.py | 24 ++-- .../tensorflow_tests/test_tf_MulNoNan.py | 16 +-- .../tensorflow_tests/test_tf_Multinomial.py | 6 +- .../test_tf_NonMaxSupression.py | 3 +- .../tensorflow_tests/test_tf_OnesLike.py | 6 +- .../tensorflow_tests/test_tf_Pad.py | 12 +- .../test_tf_ParallelDynamicStitch.py | 6 +- .../tensorflow_tests/test_tf_Placeholder.py | 1 - .../tensorflow_tests/test_tf_Range.py | 12 +- .../tensorflow_tests/test_tf_Reciprocal.py | 6 +- .../test_tf_ReduceArithmeticOps.py | 6 +- .../tensorflow_tests/test_tf_Reshape.py | 18 +-- .../tensorflow_tests/test_tf_Resize.py | 6 +- .../test_tf_ReverseSequence.py | 12 +- .../tensorflow_tests/test_tf_SegmentSum.py | 12 +- .../tensorflow_tests/test_tf_Select.py | 18 +-- .../tensorflow_tests/test_tf_SelectV2.py | 18 +-- .../tensorflow_tests/test_tf_Shape.py | 20 +-- .../tensorflow_tests/test_tf_Size.py | 6 +- .../tensorflow_tests/test_tf_Softmax.py | 6 +- .../tensorflow_tests/test_tf_Squeeze.py | 18 +-- .../tensorflow_tests/test_tf_StridedSlice.py | 12 +- .../tensorflow_tests/test_tf_SwitchMerge.py | 6 +- .../test_tf_TensorArrayOps.py | 48 +++---- .../test_tf_TensorListConcatV2.py | 6 +- .../test_tf_TensorListLength.py | 8 +- .../test_tf_TensorListResize.py | 6 +- .../tensorflow_tests/test_tf_Tile.py | 12 +- .../tensorflow_tests/test_tf_ToBool.py | 6 +- .../tensorflow_tests/test_tf_TopKV2.py | 6 +- .../tensorflow_tests/test_tf_Transpose.py | 12 +- .../tensorflow_tests/test_tf_TruncateDiv.py | 12 +- .../tensorflow_tests/test_tf_TruncateMod.py | 12 +- .../tensorflow_tests/test_tf_Unique.py | 6 +- .../test_tf_UniqueWithCounts.py | 6 +- .../tensorflow_tests/test_tf_Unpack.py | 6 +- .../tensorflow_tests/test_tf_UnravelIndex.py | 6 +- .../test_tf_UnsortedSegmentSum.py | 12 +- .../tensorflow_tests/test_tf_Where.py | 6 +- .../tensorflow_tests/test_tf_While.py | 36 +++--- .../tensorflow_tests/test_tf_Xlog1py.py | 12 +- .../tensorflow_tests/test_tf_Xlogy.py | 12 +- .../tools/mo/moc_frontend/extractor.py | 2 +- .../tools/mo/moc_frontend/pipeline.py | 2 +- .../moc_tf_fe/conversion_basic_models_test.py | 32 ++--- .../conversion_with_checkpoint_v1_test.py | 2 +- .../moc_tf_fe/conversion_with_layout_test.py | 24 ++-- .../moc_tf_fe/conversion_basic_models_test.py | 16 +-- .../conversion_with_checkpoint_v1_test.py | 2 +- 96 files changed, 812 insertions(+), 603 deletions(-) diff --git a/src/bindings/python/src/openvino/frontend/tensorflow/graph_iterator.py b/src/bindings/python/src/openvino/frontend/tensorflow/graph_iterator.py index 83dd7ea25a6..3eeb2d9d4ec 100644 --- a/src/bindings/python/src/openvino/frontend/tensorflow/graph_iterator.py +++ b/src/bindings/python/src/openvino/frontend/tensorflow/graph_iterator.py @@ -42,7 +42,7 @@ class GraphIteratorTFGraph(GraphIterator): inp_names = [] if hasattr(self.m_graph, 'inputs') and self.m_graph.inputs: for inp in self.m_graph.inputs: - inp_names.append(inp.op.name) + inp_names.append(inp.name) return inp_names for inp in inp_ops: assert isinstance(inp, tf.Operation), "Unknown node type. Expected tf.Operation, got {}".format(type(inp)) diff --git a/src/bindings/python/src/openvino/frontend/tensorflow/utils.py b/src/bindings/python/src/openvino/frontend/tensorflow/utils.py index 216aad68052..036c4c6c9a8 100644 --- a/src/bindings/python/src/openvino/frontend/tensorflow/utils.py +++ b/src/bindings/python/src/openvino/frontend/tensorflow/utils.py @@ -284,6 +284,16 @@ def type_supported_by_tf_fe(input_model): return False +def is_variable(func_input, captures): + import tensorflow as tf + if func_input.dtype == tf.resource: + return True + for capture in captures: + if id(func_input) == id(capture[1]): + return True + return False + + def create_tf_graph_iterator(input_model, placeholder_shapes, placeholder_data_types, example_input, share_weights): input_model = trace_tf_model_if_needed(input_model, placeholder_shapes, placeholder_data_types, example_input) @@ -300,7 +310,7 @@ def create_tf_graph_iterator(input_model, placeholder_shapes, placeholder_data_t if hasattr(input_model, 'inputs') and hasattr(input_model, 'structured_input_signature'): internal_tensor_names = [] for func_input in input_model.inputs: - if func_input.dtype == tf.resource: + if is_variable(func_input, input_model.graph.captures): continue internal_tensor_names.append(func_input.name) if len(input_model.structured_input_signature) > 0 and \ diff --git a/src/frontends/tensorflow/src/input_model.cpp b/src/frontends/tensorflow/src/input_model.cpp index df32370c8cd..a88c1df7811 100644 --- a/src/frontends/tensorflow/src/input_model.cpp +++ b/src/frontends/tensorflow/src/input_model.cpp @@ -79,7 +79,7 @@ public: std::vector> get_op_places(); std::map> get_tensor_places() const { - return m_tensor_places; + return m_default_places; } std::map> get_tensor_values() const { return m_tensor_values; @@ -98,7 +98,7 @@ private: std::vector> m_op_places; std::map> m_op_places_map; - mutable std::map> m_tensor_places; + mutable std::map> m_default_places; std::vector m_inputs; std::vector m_outputs; std::map> m_tensor_values; @@ -181,15 +181,15 @@ void InputModel::InputModelTFImpl::load_places() { // put places for all inputs of a model into m_inputs if (op_type == "Placeholder" || op_type == "PlaceholderWithDefault") { if (m_input_names.size() > 0 && - std::find(m_input_names.begin(), m_input_names.end(), op_name) == m_input_names.end()) { + std::find(m_input_names.begin(), m_input_names.end(), op_name + ":0") == m_input_names.end()) { // this is a body graph since it contains non-empty m_input_names // such node not included into m_input_names should be skipped continue; } - // in case Placeholder we put created TensorPlace to both m_tensor_places container and m_inputs + // in case Placeholder we put created TensorPlace to both m_default_places container and m_inputs // since they can be used if user does not override them - // in case PlaceholderWithDefault we put created TensorPlace only to m_tensor_places container + // in case PlaceholderWithDefault we put created TensorPlace only to m_default_places container // so that we know its shape and type for a case of custom input // by default, PlaceholderWithDefault is replaced by Constant with the default value auto pshape = ov::PartialShape::dynamic(); @@ -220,16 +220,10 @@ void InputModel::InputModelTFImpl::load_places() { if (dtype_any.is()) { type = dtype_any.as(); } - std::vector names = {op_name}; + std::vector names = {op_name + ":0"}; auto tensor_place = std::make_shared(m_input_model, pshape, type, names); - // In Model Optimizer user can refer to model inputs by a name of Placeholder - // and its output port, for example, using `input_name` and `input_name:0` - // Also, SavedModel format contains a signature that maps external input names to internal ones with port - // index like `input_name` maps to `serving_default_input_name:0`. - // So we have to store with `:0` as well to get its tensor by `get_place_by_tensor_name` method - m_tensor_places[op_name] = tensor_place; - m_tensor_places[op_name + ":0"] = tensor_place; + m_default_places[op_name + ":0"] = tensor_place; if (op_type == "Placeholder") { // by default, PlaceholderWithDefault is NOT used as input @@ -276,7 +270,7 @@ void InputModel::InputModelTFImpl::load_places() { ov::PartialShape({}), ov::element::dynamic, std::vector{output_internal_tensor_name}); - m_tensor_places[output_internal_tensor_name] = output_place; + m_default_places[output_internal_tensor_name] = output_place; m_outputs.push_back(output_place); } return; @@ -297,7 +291,7 @@ void InputModel::InputModelTFImpl::load_places() { ov::element::dynamic, std::vector{output_name + ":0"}); // TODO: Create tensor places for each ouput port, ticket-129464 - m_tensor_places[output_name + ":0"] = output_place; + m_default_places[output_name + ":0"] = output_place; m_outputs.push_back(output_place); } return; @@ -307,7 +301,7 @@ void InputModel::InputModelTFImpl::load_places() { ov::PartialShape({}), ov::element::dynamic, std::vector{output_name}); - m_tensor_places[output_name] = output_place; + m_default_places[output_name] = output_place; m_outputs.push_back(output_place); } } @@ -429,16 +423,16 @@ std::vector> InputModel::InputModelTFImpl::topologicall // 1. check if the current node is pruned by its input port bool is_input = false; std::string input_port_name = std::to_string(input_port_idx) + ":" + current_operation_name; - if (m_tensor_places.find(input_port_name) != m_tensor_places.end()) { - const auto& tensor_place = m_tensor_places[input_port_name]; + if (m_default_places.find(input_port_name) != m_default_places.end()) { + const auto& tensor_place = m_default_places[input_port_name]; is_input |= tensor_place->is_input(); m_found_inputs.insert(input_port_name); } // 2. check if the producer node is pruned by its output port std::string output_port_name = producer_name + ":" + std::to_string(producer_output_port_idx); - if (m_tensor_places.find(output_port_name) != m_tensor_places.end()) { - const auto& tensor_place = m_tensor_places[output_port_name]; + if (m_default_places.find(output_port_name) != m_default_places.end()) { + const auto& tensor_place = m_default_places[output_port_name]; is_input |= tensor_place->is_input(); m_found_inputs.insert(output_port_name); } @@ -447,8 +441,8 @@ std::vector> InputModel::InputModelTFImpl::topologicall FRONT_END_GENERAL_CHECK(m_op_places_map.count(producer_name), "There is no operation node with name: " + producer_name); const auto& producer_operation_place = m_op_places_map.at(producer_name); - if (m_tensor_places.find(producer_name) != m_tensor_places.end()) { - const auto& tensor_place = m_tensor_places[producer_name]; + if (m_default_places.find(producer_name) != m_default_places.end()) { + const auto& tensor_place = m_default_places[producer_name]; is_input |= tensor_place->is_input(); m_found_inputs.insert(producer_name); } @@ -570,7 +564,7 @@ ov::frontend::Place::Ptr InputModel::InputModelTFImpl::get_place_by_tensor_name( std::string internal_tensor_name = tensorName; // For SavedModel format, an user can work with external input names, namely, without `serving_default_` prefix - // so we have to map it into the internal name to find the tensor in the tensor pool m_tensor_places. + // so we have to map it into the internal name to find the tensor in the tensor pool m_default_places. // m_saved_model_input_names contains a map from external name to the internal name with port ':0' // for example, `input_mask` maps to `serving_default_input_mask:0` if (m_saved_model_input_names) { @@ -591,8 +585,17 @@ ov::frontend::Place::Ptr InputModel::InputModelTFImpl::get_place_by_tensor_name( } } - if (m_tensor_places.find(internal_tensor_name) != m_tensor_places.end()) { - return m_tensor_places.at(internal_tensor_name); + if (m_default_places.find(internal_tensor_name) != m_default_places.end()) { + return m_default_places.at(internal_tensor_name); + } else if (m_default_places.find(internal_tensor_name + ":0") != m_default_places.end()) { + auto default_place = m_default_places.at(internal_tensor_name + ":0"); + std::vector names = {internal_tensor_name}; + auto new_place = std::make_shared(m_input_model, + default_place->get_partial_shape(), + default_place->get_element_type(), + names); + m_default_places[internal_tensor_name] = new_place; + return new_place; } // check that operation node exists for which this place is specified @@ -606,7 +609,7 @@ ov::frontend::Place::Ptr InputModel::InputModelTFImpl::get_place_by_tensor_name( std::vector names = {internal_tensor_name}; auto m_var_place = std::make_shared(m_input_model, ov::PartialShape::dynamic(), ov::element::dynamic, names); - m_tensor_places[internal_tensor_name] = m_var_place; + m_default_places[internal_tensor_name] = m_var_place; return m_var_place; } diff --git a/src/frontends/tensorflow/src/translate_session.cpp b/src/frontends/tensorflow/src/translate_session.cpp index 68d2fd8dfcc..a70d4bb891d 100644 --- a/src/frontends/tensorflow/src/translate_session.cpp +++ b/src/frontends/tensorflow/src/translate_session.cpp @@ -446,7 +446,8 @@ void TranslateSession::translate_graph(const ov::frontend::InputModel::Ptr& inpu } auto param = std::make_shared(input_type, input_shape); - set_node_name(input_name, param); + param->set_friendly_name(input_name); + set_out_name(input_name, param); params.push_back(param); (*ov_tensors_map)[input_name] = {NamedOutput(param)}; } diff --git a/src/frontends/tensorflow/tests/convert_tricky_models.cpp b/src/frontends/tensorflow/tests/convert_tricky_models.cpp index 77430c9e0bd..dc8b621d6b2 100644 --- a/src/frontends/tensorflow/tests/convert_tricky_models.cpp +++ b/src/frontends/tensorflow/tests/convert_tricky_models.cpp @@ -773,7 +773,7 @@ TEST_F(FrontEndConversionWithReferenceTestsF, TF1IfWithNonExistentOpInBranch) { {}, {}, {}, - {"cond"}, + {"cond:0"}, {&cond_value}); } { diff --git a/src/frontends/tensorflow_common/src/op/identity.cpp b/src/frontends/tensorflow_common/src/op/identity.cpp index 3d66e5a5c02..11eb7aeaa10 100644 --- a/src/frontends/tensorflow_common/src/op/identity.cpp +++ b/src/frontends/tensorflow_common/src/op/identity.cpp @@ -27,9 +27,13 @@ OutputVector translate_identity_op(const NodeContext& node) { default_op_checks(node, 1, supported_ops, true); auto input = node.get_input(0); - // set only tensor names - // no need to change node name since Identity node is skipped - set_out_name(node.get_name() + ":" + "0", input); + // We do not add tensor name, if producer node is Parameter + // to prevent multiple names on model inputs + if (!as_type_ptr(input.get_node_shared_ptr())) { + // set only tensor names + // no need to change node name since Identity node is skipped + set_out_name(node.get_name() + ":" + "0", input); + } return {input}; } diff --git a/src/frontends/tensorflow_common/src/utils.cpp b/src/frontends/tensorflow_common/src/utils.cpp index 5baa6a24b2d..49065ae8036 100644 --- a/src/frontends/tensorflow_common/src/utils.cpp +++ b/src/frontends/tensorflow_common/src/utils.cpp @@ -35,10 +35,6 @@ namespace tensorflow { void set_node_name(const string& node_name, const shared_ptr& node) { const auto& outputs = node->outputs(); node->set_friendly_name(node_name); - // TODO: Remove this and set single tensor names for model inputs, ticket - 129457 - if (outputs.size() == 1 && as_type_ptr(node)) { - set_out_name(node_name, outputs[0]); - } for (size_t idx = 0; idx < outputs.size(); ++idx) { set_out_name({node_name + ":" + to_string(idx)}, outputs[idx]); } diff --git a/tests/layer_tests/common/layer_test_class.py b/tests/layer_tests/common/layer_test_class.py index e9997ad92e4..c20a76bea14 100644 --- a/tests/layer_tests/common/layer_test_class.py +++ b/tests/layer_tests/common/layer_test_class.py @@ -168,8 +168,12 @@ class CommonLayerTest: from common.utils.common_utils import allclose for framework_out_name in framework_res: ie_out_name = framework_out_name + if ie_out_name not in infer_res and len(infer_res) == 1: + ie_res = list(infer_res.values())[0] + else: + ie_res = infer_res[ie_out_name] - if not allclose(infer_res[ie_out_name], framework_res[framework_out_name], + if not allclose(ie_res, framework_res[framework_out_name], atol=framework_eps, rtol=framework_eps): is_ok = False diff --git a/tests/layer_tests/mo_python_api_tests/test_mo_convert_complex_params.py b/tests/layer_tests/mo_python_api_tests/test_mo_convert_complex_params.py index 00c8a2588c2..19956564b43 100644 --- a/tests/layer_tests/mo_python_api_tests/test_mo_convert_complex_params.py +++ b/tests/layer_tests/mo_python_api_tests/test_mo_convert_complex_params.py @@ -151,33 +151,33 @@ class TestComplexParams(CommonMOConvertTest): 'params_ref': {'input': "Relu1[3 2]{i32},Relu2[3..10 2..]{i32},Relu3[3 2]{i32}"}}, {'params_test': {'output': ["Sigmoid_0", "Sigmoid_2"]}, 'params_ref': {'output': "Sigmoid_0,Sigmoid_2"}}, - {'params_test': {'mean_values': {'Input1': [0.5,1.3,0.67], 'Input2':[4.2, 6.7, 3.15], 'Input3':[0.757, 4.6, 7.3]}, + {'params_test': {'mean_values': {'Input1:0': [0.5,1.3,0.67], 'Input2:0':[4.2, 6.7, 3.15], 'Input3:0':[0.757, 4.6, 7.3]}, 'compress_to_fp16': True}, - 'params_ref': {'mean_values': "Input1[0.5,1.3,0.67],Input2[4.2,6.7,3.15],Input3[0.757,4.6,7.3]"}}, + 'params_ref': {'mean_values': "Input1:0[0.5,1.3,0.67],Input2:0[4.2,6.7,3.15],Input3:0[0.757,4.6,7.3]"}}, {'params_test': { 'mean_values': [[0.5, 1.3, 0.67], [4.2, 6.7, 3.15], [0.757, 4.6, 7.3]], 'compress_to_fp16': True}, 'params_ref': {'mean_values': "[0.5,1.3,0.67],[4.2,6.7,3.15],[0.757,4.6,7.3]"}}, - {'params_test': {'scale_values': {'Input1': [0.5,1.3,0.67], 'Input2':[4.2, 6.7, 3.15], 'Input3':[0.757, 4.6, 7.3]}, + {'params_test': {'scale_values': {'Input1:0': [0.5,1.3,0.67], 'Input2:0':[4.2, 6.7, 3.15], 'Input3:0':[0.757, 4.6, 7.3]}, 'compress_to_fp16': True}, - 'params_ref': {'scale_values': "Input1[0.5,1.3,0.67],Input2[4.2,6.7,3.15],Input3[0.757,4.6,7.3]"}}, + 'params_ref': {'scale_values': "Input1:0[0.5,1.3,0.67],Input2:0[4.2,6.7,3.15],Input3:0[0.757,4.6,7.3]"}}, {'params_test': { 'scale_values': [[0.5, 1.3, 0.67], [4.2, 6.7, 3.15], [0.757, 4.6, 7.3]], 'compress_to_fp16': True}, 'params_ref': {'scale_values': "[0.5,1.3,0.67],[4.2,6.7,3.15],[0.757,4.6,7.3]"}}, {'params_test': { - 'source_layout': {'Input1': Layout("nchw"), 'Input2': "nchw", 'Input3': "nc??"}, 'compress_to_fp16': True}, - 'params_ref': {'source_layout': "Input1(nchw),Input2(nchw),Input3(nc??)"}}, + 'source_layout': {'Input1:0': Layout("nchw"), 'Input2:0': "nchw", 'Input3:0': "nc??"}, 'compress_to_fp16': True}, + 'params_ref': {'source_layout': "Input1:0(nchw),Input2:0(nchw),Input3:0(nc??)"}}, {'params_test': { - 'target_layout': {'Input1': Layout("nhwc"), 'Input2': "nhwc", 'Input3': "n??c"}, 'compress_to_fp16': True}, - 'params_ref': {'target_layout': "Input1(nhwc),Input2(nhwc),Input3(n??c)"}}, + 'target_layout': {'Input1:0': Layout("nhwc"), 'Input2:0': "nhwc", 'Input3:0': "n??c"}, 'compress_to_fp16': True}, + 'params_ref': {'target_layout': "Input1:0(nhwc),Input2:0(nhwc),Input3:0(n??c)"}}, {'params_test': { - 'layout': {'Input1': LayoutMap(source_layout=Layout("nchw"), target_layout="nhwc"), - 'Input2': LayoutMap(source_layout="nc??", target_layout=Layout("n??c")), - 'Input3': LayoutMap(source_layout="abcd", target_layout="acdb")}, 'compress_to_fp16': True}, - 'params_ref': {'layout': "Input1(nchw->nhwc),Input2(nc??->n??c),Input3(abcd->acdb)"}}, + 'layout': {'Input1:0': LayoutMap(source_layout=Layout("nchw"), target_layout="nhwc"), + 'Input2:0': LayoutMap(source_layout="nc??", target_layout=Layout("n??c")), + 'Input3:0': LayoutMap(source_layout="abcd", target_layout="acdb")}, 'compress_to_fp16': True}, + 'params_ref': {'layout': "Input1:0(nchw->nhwc),Input2:0(nc??->n??c),Input3:0(abcd->acdb)"}}, {'params_test': {'input': [PartialShape([2, 3, 4]), [2, 3, 4], [Dimension(2), Dimension(3), Dimension(4)]]}, - 'params_ref': {'input_shape': "[2,3,4],[2,3,4],[2,3,4]", 'input': 'Input1,Input2,Input3'}}, + 'params_ref': {'input_shape': "[2,3,4],[2,3,4],[2,3,4]", 'input': 'Input1:0,Input2:0,Input3:0'}}, {'params_test': {'input': [np.int32, Type(np.int32), np.int32]}, - 'params_ref': {'input': 'Input1{i32},Input2{i32},Input3{i32}'}}, + 'params_ref': {'input': 'Input1:0{i32},Input2:0{i32},Input3:0{i32}'}}, {'params_test': {'input': [InputCutInfo(shape=[1], type=np.int32, value=[10]), InputCutInfo(shape=[1], type=np.int32, value=[20]), InputCutInfo(shape=[1], type=np.int32, value=[30])]}, @@ -206,13 +206,13 @@ class TestComplexParams(CommonMOConvertTest): {'params_test': {'input': [PartialShape([Dimension(-1), 5, 6]), [-1, 5, 6]], 'freeze_placeholder_with_value': 'Input3->[1]'}, - 'params_ref': {'input': 'Input1[?,5,6],Input2[?,5,6]', + 'params_ref': {'input': 'Input1:0[?,5,6],Input2:0[?,5,6]', 'freeze_placeholder_with_value': 'Input3->[1]'}}, {'params_test': {'input': [np.float16, np.float16], 'input_shape': [[10, 20], [10, 20]], 'freeze_placeholder_with_value': 'Input3->[1]'}, - 'params_ref': {'input': 'Input1{f16},Input2{f16}', + 'params_ref': {'input': 'Input1:0{f16},Input2:0{f16}', 'input_shape': "[10,20],[10,20]", 'freeze_placeholder_with_value': 'Input3->[1]'}}, @@ -283,27 +283,27 @@ class TestComplexParams(CommonMOConvertTest): {'params_test': {'layout': Layout("nchw"), 'compress_to_fp16': True}, 'params_ref': {'layout': "nchw"}}, {'params_test': {'input': [3, 2]}, - 'params_ref': {'input': "Input[3 2]"}}, + 'params_ref': {'input': "Input:0[3 2]"}}, {'params_test': {'input': [Dimension(3,10), 2]}, - 'params_ref': {'input': "Input[3..10 2]"}}, + 'params_ref': {'input': "Input:0[3..10 2]"}}, {'params_test': {'input': (-1, 10)}, - 'params_ref': {'input': "Input[?,10]"}}, + 'params_ref': {'input': "Input:0[?,10]"}}, {'params_test': {'input': PartialShape([-1, 10])}, - 'params_ref': {'input': "Input[?,10]"}}, + 'params_ref': {'input': "Input:0[?,10]"}}, {'params_test': {'input': np.int32}, - 'params_ref': {'input': "Input{i32}"}}, + 'params_ref': {'input': "Input:0{i32}"}}, {'params_test': {'input': InputCutInfo(shape=[1], type=np.int32, value=[10])}, - 'params_ref': {'input': "Input[1]{i32}->[10]"}}, + 'params_ref': {'input': "Input:0[1]{i32}->[10]"}}, {'params_test': {'input': (np.int32, [1, 2, 3])}, - 'params_ref': {'input': "Input[1,2,3]{i32}"}}, + 'params_ref': {'input': "Input:0[1,2,3]{i32}"}}, {'params_test': {'input_shape': [Dimension(3, 10), 10, -1], 'compress_to_fp16': True}, 'params_ref': {'input_shape': '[3..10,10,?]'}}, {'params_test': {'input': [Dimension(3, 10), 10, -1]}, - 'params_ref': {'input': 'Input[3..10,10,?]'}}, + 'params_ref': {'input': 'Input:0[3..10,10,?]'}}, {'params_test': {'input': PartialShape([1, 100, 100, 3]), 'mean_values': [0.5, 1.3, 0.67], 'compress_to_fp16': True}, - 'params_ref': {'input': "Input[1,100,100,3]", 'mean_values': "[0.5,1.3,0.67]"}}, + 'params_ref': {'input': "Input:0[1,100,100,3]", 'mean_values': "[0.5,1.3,0.67]"}}, {'params_test': {'input': [1, 100, 100, 3], 'scale_values': [0.5, 1.3, 0.67], 'compress_to_fp16': True}, - 'params_ref': {'input': "Input[1,100,100,3]", 'scale_values': "[0.5,1.3,0.67]"}}, + 'params_ref': {'input': "Input:0[1,100,100,3]", 'scale_values': "[0.5,1.3,0.67]"}}, ] @pytest.mark.parametrize("params", test_data) diff --git a/tests/layer_tests/mo_python_api_tests/test_mo_convert_tf.py b/tests/layer_tests/mo_python_api_tests/test_mo_convert_tf.py index dbc36c9fcd3..6c286a26e70 100644 --- a/tests/layer_tests/mo_python_api_tests/test_mo_convert_tf.py +++ b/tests/layer_tests/mo_python_api_tests/test_mo_convert_tf.py @@ -1,15 +1,18 @@ # Copyright (C) 2018-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -import unittest - import numpy as np import openvino.runtime as ov import pytest +import tempfile +import unittest from openvino.runtime import PartialShape, Model, Dimension +from pathlib import Path -from common.mo_convert_test_class import CommonMOConvertTest +from common import constants from common.layer_test_class import CommonLayerTest +from common.mo_convert_test_class import CommonMOConvertTest +from common.tf_layer_test_class import save_to_pb def create_tf_graph_def(tmp_dir): @@ -985,3 +988,112 @@ class TestTFLoadByModel(unittest.TestCase): fe = fem.load_by_model(model) assert fe is not None assert fe.get_name() == "tf" + + +class TestInputTensorName(unittest.TestCase): + @pytest.mark.nightly + @pytest.mark.precommit + def test_tf1_from_file_single_input_name(self): + import tensorflow as tf + tf.keras.backend.clear_session() + tf.compat.v1.reset_default_graph() + Path(constants.out_path).mkdir(parents=True, exist_ok=True) + tmp_dir = tempfile.TemporaryDirectory(dir=constants.out_path).name + from openvino.tools.mo import convert_model + + model, _, _ = create_tf_graph_def(None) + path = save_to_pb(model, tmp_dir) + + ov_model = convert_model(path) + + ref_inputs = ["Input:0", "Input_1:0"] + for idx, output in enumerate(ov_model.inputs): + tensors = output.get_names() + + assert len(tensors) == 1 + out_tensor = list(tensors)[0] + assert out_tensor == ref_inputs[idx] + + ov_model = convert_model(path, input=["Input:0", "Input_1:0"]) + for idx, output in enumerate(ov_model.inputs): + tensors = output.get_names() + + assert len(tensors) == 1 + out_tensor = list(tensors)[0] + assert out_tensor == ref_inputs[idx] + + ref_inputs = ["Input", "Input_1"] + ov_model = convert_model(path, input=["Input", "Input_1"]) + for idx, output in enumerate(ov_model.inputs): + tensors = output.get_names() + + assert len(tensors) == 1 + out_tensor = list(tensors)[0] + assert out_tensor == ref_inputs[idx] + + + @pytest.mark.nightly + @pytest.mark.precommit + def test_tf1_from_memory_single_input_name(self): + import tensorflow as tf + tf.keras.backend.clear_session() + tf.compat.v1.reset_default_graph() + from openvino.tools.mo import convert_model + + model, _, _ = create_tf_graph_def(None) + + ov_model = convert_model(model) + + ref_inputs = ["Input:0", "Input_1:0"] + for idx, output in enumerate(ov_model.inputs): + tensors = output.get_names() + + assert len(tensors) == 1 + out_tensor = list(tensors)[0] + assert out_tensor == ref_inputs[idx] + + ov_model = convert_model(model, input=["Input:0", "Input_1:0"]) + for idx, output in enumerate(ov_model.inputs): + tensors = output.get_names() + + assert len(tensors) == 1 + out_tensor = list(tensors)[0] + assert out_tensor == ref_inputs[idx] + + ref_inputs = ["Input", "Input_1"] + ov_model = convert_model(model, input=["Input", "Input_1"]) + for idx, output in enumerate(ov_model.inputs): + tensors = output.get_names() + + assert len(tensors) == 1 + out_tensor = list(tensors)[0] + assert out_tensor == ref_inputs[idx] + + @pytest.mark.nightly + @pytest.mark.precommit + def test_tf1_input_with_identity(self): + import tensorflow as tf + tf.keras.backend.clear_session() + tf.compat.v1.reset_default_graph() + from openvino.tools.mo import convert_model + + with tf.compat.v1.Session() as sess: + x = tf.compat.v1.placeholder(tf.float32, [2], 'x') + y = tf.compat.v1.placeholder(tf.float32, [2], 'y') + input1 = tf.identity(x, name="x_identity") + input2 = tf.identity(y, name="y_identity") + add = tf.add(input1, input2, name="add") + + tf.compat.v1.global_variables_initializer() + model = sess.graph_def + + ov_model = convert_model(model) + + assert ov_model.inputs[0].get_names() == {"x:0"} + assert ov_model.inputs[1].get_names() == {"y:0"} + + + ov_model = convert_model(model, input=["x", "y"]) + + assert ov_model.inputs[0].get_names() == {"x"} + assert ov_model.inputs[1].get_names() == {"y"} diff --git a/tests/layer_tests/ovc_python_api_tests/test_complex_params.py b/tests/layer_tests/ovc_python_api_tests/test_complex_params.py index 48a1b0115c2..fa2690b92e6 100644 --- a/tests/layer_tests/ovc_python_api_tests/test_complex_params.py +++ b/tests/layer_tests/ovc_python_api_tests/test_complex_params.py @@ -76,35 +76,35 @@ class TestComplexParams(CommonMOConvertTest): {'params_test': {'output': ["Sigmoid_0:0"]}, 'params_ref': {'output': "Sigmoid_0"}}, {'params_test': {'input': [PartialShape([2, 3, 4]), [2, 3, 4], [Dimension(2), Dimension(3), Dimension(4)]]}, - 'params_ref': {'input_shape': "[2,3,4],[2,3,4],[2,3,4]", 'input': 'Input1,Input2,Input3'}}, + 'params_ref': {'input_shape': "[2,3,4],[2,3,4],[2,3,4]", 'input': 'Input1:0,Input2:0,Input3:0'}}, {'params_test': {'input': [PartialShape([1, 3, -1, -1]), [1, 3, -1, -1]]}, - 'params_ref': {'input_shape': "[1,3,?,?],[1,3,?,?]", 'input': 'Input1,Input2'}}, + 'params_ref': {'input_shape': "[1,3,?,?],[1,3,?,?]", 'input': 'Input1:0,Input2:0'}}, {'params_test': {'input': [(2, 3, 4), [2, 3, 4], (Dimension(2), Dimension(3), Dimension(4))]}, - 'params_ref': {'input_shape': "[2,3,4],[2,3,4],[2,3,4]", 'input': 'Input1,Input2,Input3'}}, - {'params_test': {'input': {"Input1": PartialShape([2, 3, 4]), "Input2": [2, 3, 4], - "Input3": [Dimension(2), Dimension(3), Dimension(4)]}}, - 'params_ref': {'input_shape': "[2,3,4],[2,3,4],[2,3,4]", 'input': 'Input1,Input2,Input3'}}, - {'params_test': {'input': {"Input2": [1, -1, -1, -1], - "Input3": [Dimension(1), Dimension(-1), Dimension(-1), Dimension(-1)]}}, - 'params_ref': {'input_shape': "[1,?,?,?],[1,?,?,?]", 'input': 'Input2,Input3'}}, + 'params_ref': {'input_shape': "[2,3,4],[2,3,4],[2,3,4]", 'input': 'Input1:0,Input2:0,Input3:0'}}, + {'params_test': {'input': {"Input1:0": PartialShape([2, 3, 4]), "Input2:0": [2, 3, 4], + "Input3:0": [Dimension(2), Dimension(3), Dimension(4)]}}, + 'params_ref': {'input_shape': "[2,3,4],[2,3,4],[2,3,4]", 'input': 'Input1:0,Input2:0,Input3:0'}}, + {'params_test': {'input': {"Input2:0": [1, -1, -1, -1], + "Input3:0": [Dimension(1), Dimension(-1), Dimension(-1), Dimension(-1)]}}, + 'params_ref': {'input_shape': "[1,?,?,?],[1,?,?,?]", 'input': 'Input2:0,Input3:0'}}, {'params_test': {'input': [np.int32, Type(np.int32), np.int32]}, - 'params_ref': {'input': 'Input1{i32},Input2{i32},Input3{i32}'}}, + 'params_ref': {'input': 'Input1:0{i32},Input2:0{i32},Input3:0{i32}'}}, {'params_test': {'input': [ov.Type.f32, ov.Type.f32]}, - 'params_ref': {'input': 'Input1{f32},Input2{f32}'}}, + 'params_ref': {'input': 'Input1:0{f32},Input2:0{f32}'}}, {'params_test': {'input': [([1, 3, -1, -1], ov.Type.i32), ov.Type.i32, ov.Type.i32]}, - 'params_ref': {'input': 'Input1[1,3,?,?]{i32},Input2{i32},Input3{i32}'}}, + 'params_ref': {'input': 'Input1:0[1,3,?,?]{i32},Input2:0{i32},Input3:0{i32}'}}, {'params_test': {'input': (PartialShape([2, 3, 4]), [2, 3, 4], [Dimension(2), Dimension(3), Dimension(4)])}, - 'params_ref': {'input_shape': "[2,3,4],[2,3,4],[2,3,4]", 'input': 'Input1,Input2,Input3'}}, + 'params_ref': {'input_shape': "[2,3,4],[2,3,4],[2,3,4]", 'input': 'Input1:0,Input2:0,Input3:0'}}, {'params_test': {'input': (PartialShape([1, 3, -1, -1]), [1, 3, -1, -1])}, - 'params_ref': {'input_shape': "[1,3,?,?],[1,3,?,?]", 'input': 'Input1,Input2'}}, + 'params_ref': {'input_shape': "[1,3,?,?],[1,3,?,?]", 'input': 'Input1:0,Input2:0'}}, {'params_test': {'input': ((2, 3, 4), [2, 3, 4], (Dimension(2), Dimension(3), Dimension(4)))}, - 'params_ref': {'input_shape': "[2,3,4],[2,3,4],[2,3,4]", 'input': 'Input1,Input2,Input3'}}, + 'params_ref': {'input_shape': "[2,3,4],[2,3,4],[2,3,4]", 'input': 'Input1:0,Input2:0,Input3:0'}}, {'params_test': {'input': (np.int32, Type(np.int32), np.int32)}, - 'params_ref': {'input': 'Input1{i32},Input2{i32},Input3{i32}'}}, + 'params_ref': {'input': 'Input1:0{i32},Input2:0{i32},Input3:0{i32}'}}, {'params_test': {'input': (ov.Type.f32, ov.Type.f32)}, - 'params_ref': {'input': 'Input1{f32},Input2{f32}'}}, + 'params_ref': {'input': 'Input1:0{f32},Input2:0{f32}'}}, {'params_test': {'input': (([1, 3, -1, -1], ov.Type.i32), ov.Type.i32, ov.Type.i32)}, - 'params_ref': {'input': 'Input1[1,3,?,?]{i32},Input2{i32},Input3{i32}'}} + 'params_ref': {'input': 'Input1:0[1,3,?,?]{i32},Input2:0{i32},Input3:0{i32}'}} ] @pytest.mark.parametrize("params", test_data) @@ -120,30 +120,30 @@ class TestComplexParams(CommonMOConvertTest): self._test(temp_dir, test_params, ref_params) test_data = [ - {'params_test': {'input': {"Input": ([3, 2], ov.Type.i32)}}, - 'params_ref': {'input': "Input[3,2]{i32}"}}, - {'params_test': {'input': {"Input": ov.Type.i32}}, - 'params_ref': {'input': "Input{i32}"}}, - {'params_test': {'input': {"Input": [3, 2]}}, - 'params_ref': {'input': "Input[3,2]"}}, + {'params_test': {'input': {"Input:0": ([3, 2], ov.Type.i32)}}, + 'params_ref': {'input': "Input:0[3,2]{i32}"}}, + {'params_test': {'input': {"Input:0": ov.Type.i32}}, + 'params_ref': {'input': "Input:0{i32}"}}, + {'params_test': {'input': {"Input:0": [3, 2]}}, + 'params_ref': {'input': "Input:0[3,2]"}}, {'params_test': {'input': (3, 2)}, - 'params_ref': {'input': "Input[3,2]"}}, + 'params_ref': {'input': "Input:0[3,2]"}}, {'params_test': {'input': (3, Dimension(2))}, - 'params_ref': {'input': "Input[3,2]"}}, + 'params_ref': {'input': "Input:0[3,2]"}}, {'params_test': {'input': [3, 2]}, - 'params_ref': {'input': "Input[3 2]"}}, + 'params_ref': {'input': "Input:0[3 2]"}}, {'params_test': {'input': [Dimension(3, 10), 2]}, - 'params_ref': {'input': "Input[3..10 2]"}}, + 'params_ref': {'input': "Input:0[3..10 2]"}}, {'params_test': {'input': (-1, 10)}, - 'params_ref': {'input': "Input[?,10]"}}, + 'params_ref': {'input': "Input:0[?,10]"}}, {'params_test': {'input': PartialShape([-1, 10])}, - 'params_ref': {'input': "Input[?,10]"}}, + 'params_ref': {'input': "Input:0[?,10]"}}, {'params_test': {'input': np.int32}, - 'params_ref': {'input': "Input{i32}"}}, + 'params_ref': {'input': "Input:0{i32}"}}, {'params_test': {'input': (np.int32, [1, 2, 3])}, - 'params_ref': {'input': "Input[1,2,3]{i32}"}}, + 'params_ref': {'input': "Input:0[1,2,3]{i32}"}}, {'params_test': {'input': [Dimension(3, 10), 10, -1]}, - 'params_ref': {'input': 'Input[3..10,10,?]'}}, + 'params_ref': {'input': 'Input:0[3..10,10,?]'}}, ] @pytest.mark.parametrize("params", test_data) diff --git a/tests/layer_tests/ovc_python_api_tests/test_tf.py b/tests/layer_tests/ovc_python_api_tests/test_tf.py index 20d1c4d27e4..55c49484b8b 100644 --- a/tests/layer_tests/ovc_python_api_tests/test_tf.py +++ b/tests/layer_tests/ovc_python_api_tests/test_tf.py @@ -978,7 +978,7 @@ class TFGraphDefNames(unittest.TestCase): tf.import_graph_def(tf_model, name='') for op in graph.get_operations(): if op.type == "Placeholder": - input_list.append(op.name) + input_list.append(op.name + ":0") for input in input_list: found = False @@ -1205,3 +1205,85 @@ class TestOutputTensorName(unittest.TestCase): assert ov_model.outputs[0].get_names() == {"result1:0", "result2:0", "add:0"} assert ov_model.outputs[1].get_names() == {"result1:0", "result2:0", "add:0"} + + +class TestInputTensorName(unittest.TestCase): + @pytest.mark.nightly + @pytest.mark.precommit + def test_tf1_from_file_single_input_name(self): + tf.keras.backend.clear_session() + tf.compat.v1.reset_default_graph() + Path(constants.out_path).mkdir(parents=True, exist_ok=True) + tmp_dir = tempfile.TemporaryDirectory(dir=constants.out_path).name + from openvino import convert_model + + model, _, _ = create_tf_graph_def(None) + path = save_to_pb(model, tmp_dir) + + ov_model = convert_model(path) + + ref_inputs = ["Input:0", "Input_1:0"] + for idx, output in enumerate(ov_model.inputs): + tensors = output.get_names() + + assert len(tensors) == 1 + out_tensor = list(tensors)[0] + assert out_tensor == ref_inputs[idx] + + ov_model = convert_model(path, input=["Input:0", "Input_1:0"]) + for idx, output in enumerate(ov_model.inputs): + tensors = output.get_names() + + assert len(tensors) == 1 + out_tensor = list(tensors)[0] + assert out_tensor == ref_inputs[idx] + + + @pytest.mark.nightly + @pytest.mark.precommit + def test_tf1_from_memory_single_input_name(self): + tf.keras.backend.clear_session() + tf.compat.v1.reset_default_graph() + from openvino import convert_model + + model, _, _ = create_tf_graph_def(None) + + ov_model = convert_model(model) + + ref_inputs = ["Input:0", "Input_1:0"] + for idx, output in enumerate(ov_model.inputs): + tensors = output.get_names() + + assert len(tensors) == 1 + out_tensor = list(tensors)[0] + assert out_tensor == ref_inputs[idx] + + ov_model = convert_model(model, input=["Input:0", "Input_1:0"]) + for idx, output in enumerate(ov_model.inputs): + tensors = output.get_names() + + assert len(tensors) == 1 + out_tensor = list(tensors)[0] + assert out_tensor == ref_inputs[idx] + + @pytest.mark.nightly + @pytest.mark.precommit + def test_tf1_input_with_identity(self): + tf.keras.backend.clear_session() + tf.compat.v1.reset_default_graph() + from openvino.tools.ovc import convert_model + + with tf.compat.v1.Session() as sess: + x = tf.compat.v1.placeholder(tf.float32, [2], 'x') + y = tf.compat.v1.placeholder(tf.float32, [2], 'y') + input1 = tf.identity(x, name="x_identity") + input2 = tf.identity(y, name="y_identity") + add = tf.add(input1, input2, name="add") + + tf.compat.v1.global_variables_initializer() + model = sess.graph_def + + ov_model = convert_model(model) + + assert ov_model.inputs[0].get_names() == {"x:0"} + assert ov_model.inputs[1].get_names() == {"y:0"} diff --git a/tests/layer_tests/tensorflow_tests/test_tf_AddTypes.py b/tests/layer_tests/tensorflow_tests/test_tf_AddTypes.py index 2948069f4db..2c747975977 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_AddTypes.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_AddTypes.py @@ -11,15 +11,15 @@ rng = np.random.default_rng() class TestAddTypes(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + x_shape = inputs_info['x:0'] inputs_data = {} if np.issubdtype(self.input_type, np.floating): - inputs_data['x'] = rng.uniform(-5.0, 5.0, x_shape).astype(self.input_type) + inputs_data['x:0'] = rng.uniform(-5.0, 5.0, x_shape).astype(self.input_type) elif np.issubdtype(self.input_type, np.signedinteger): - inputs_data['x'] = rng.integers(-8, 8, x_shape).astype(self.input_type) + inputs_data['x:0'] = rng.integers(-8, 8, x_shape).astype(self.input_type) else: - inputs_data['x'] = rng.integers(0, 8, x_shape).astype(self.input_type) + inputs_data['x:0'] = rng.integers(0, 8, x_shape).astype(self.input_type) return inputs_data def create_add_types_net(self, const_shape, input_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_AdjustContrastv2.py b/tests/layer_tests/tensorflow_tests/test_tf_AdjustContrastv2.py index 465799bfc6a..5a3ade4070e 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_AdjustContrastv2.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_AdjustContrastv2.py @@ -11,11 +11,11 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestAdjustContrastv2(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'images' in inputs_info - images_shape = inputs_info['images'] + assert 'images:0' in inputs_info + images_shape = inputs_info['images:0'] inputs_data = {} - inputs_data['images'] = np.random.rand(*images_shape).astype(self.input_type) - inputs_data['contrast_factor'] = np.random.rand() + inputs_data['images:0'] = np.random.rand(*images_shape).astype(self.input_type) + inputs_data['contrast_factor:0'] = np.random.rand() return inputs_data def create_adjust_contrast_net(self, input_shape, input_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_ArgMinMax.py b/tests/layer_tests/tensorflow_tests/test_tf_ArgMinMax.py index 11b05a121a5..33614cae316 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_ArgMinMax.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_ArgMinMax.py @@ -20,11 +20,11 @@ OPS = { class TestArgMinMax(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'input' in inputs_info - input_shape = inputs_info['input'] + assert 'input:0' in inputs_info + input_shape = inputs_info['input:0'] inputs_data = {} rng = np.random.default_rng() - inputs_data['input'] = rng.integers(-8, 8, input_shape).astype(self.input_type) + inputs_data['input:0'] = rng.integers(-8, 8, input_shape).astype(self.input_type) return inputs_data def create_argmin_max_net(self, input_shape, dimension, input_type, output_type, op_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_AssignOps.py b/tests/layer_tests/tensorflow_tests/test_tf_AssignOps.py index b9056dc595e..92512c26d92 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_AssignOps.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_AssignOps.py @@ -16,15 +16,15 @@ OPS = { class TestAssignOps(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + x_shape = inputs_info['x:0'] inputs_data = {} if np.issubdtype(self.input_type, np.floating): - inputs_data['x'] = rng.uniform(-2.0, 2.0, x_shape).astype(self.input_type) + inputs_data['x:0'] = rng.uniform(-2.0, 2.0, x_shape).astype(self.input_type) elif np.issubdtype(self.input_type, np.signedinteger): - inputs_data['x'] = rng.integers(-8, 8, x_shape).astype(self.input_type) + inputs_data['x:0'] = rng.integers(-8, 8, x_shape).astype(self.input_type) else: - inputs_data['x'] = rng.integers(0, 8, x_shape).astype(self.input_type) + inputs_data['x:0'] = rng.integers(0, 8, x_shape).astype(self.input_type) return inputs_data def create_assign_net(self, const_shape, input_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_AssignVariableOps.py b/tests/layer_tests/tensorflow_tests/test_tf_AssignVariableOps.py index 25d06dca26d..03ee7a43faa 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_AssignVariableOps.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_AssignVariableOps.py @@ -11,10 +11,10 @@ rng = np.random.default_rng() class TestAssignVariableOps(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + x_shape = inputs_info['x:0'] inputs_data = {} - inputs_data['x'] = rng.uniform(-2.0, 2.0, x_shape).astype(np.float32) + inputs_data['x:0'] = rng.uniform(-2.0, 2.0, x_shape).astype(np.float32) return inputs_data def create_assign_variable_ops_net(self, const_shape): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Atan2.py b/tests/layer_tests/tensorflow_tests/test_tf_Atan2.py index 2bb91bbabd6..a81ae29734b 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Atan2.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Atan2.py @@ -9,13 +9,13 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestAtan2(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'y' in inputs_info - assert 'x' in inputs_info - y_shape = inputs_info['y'] - x_shape = inputs_info['x'] + assert 'y:0' in inputs_info + assert 'x:0' in inputs_info + y_shape = inputs_info['y:0'] + x_shape = inputs_info['x:0'] inputs_data = {} - inputs_data['y'] = np.random.rand(*y_shape).astype(self.input_type) - np.random.rand(*y_shape).astype(self.input_type) - inputs_data['x'] = np.random.rand(*x_shape).astype(self.input_type) - np.random.rand(*x_shape).astype(self.input_type) + inputs_data['y:0'] = np.random.rand(*y_shape).astype(self.input_type) - np.random.rand(*y_shape).astype(self.input_type) + inputs_data['x:0'] = np.random.rand(*x_shape).astype(self.input_type) - np.random.rand(*x_shape).astype(self.input_type) return inputs_data def create_atan2_net(self, input_shape, input_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_BroadcastArgs.py b/tests/layer_tests/tensorflow_tests/test_tf_BroadcastArgs.py index 90e34024744..be9ad29478d 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_BroadcastArgs.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_BroadcastArgs.py @@ -9,17 +9,17 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestBroadcastArgs(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 's0' in inputs_info, "Test error: inputs_info must contain `s0`" - assert 's1' in inputs_info, "Test error: inputs_info must contain `s1`" - s0_shape = inputs_info['s0'] - s1_shape = inputs_info['s1'] + assert 's0:0' in inputs_info, "Test error: inputs_info must contain `s0`" + assert 's1:0' in inputs_info, "Test error: inputs_info must contain `s1`" + s0_shape = inputs_info['s0:0'] + s1_shape = inputs_info['s1:0'] inputs_data = {} - inputs_data['s0'] = np.random.randint(1, 6, s0_shape) - inputs_data['s1'] = np.random.randint(1, 6, s1_shape) + inputs_data['s0:0'] = np.random.randint(1, 6, s0_shape) + inputs_data['s1:0'] = np.random.randint(1, 6, s1_shape) # compute mask where we need to change dimension size in s1 # so that s1 will be broadcastable to s0 - non_one_mask = inputs_data['s0'] != 1 - diff_size = len(inputs_data['s1']) - len(inputs_data['s0']) + non_one_mask = inputs_data['s0:0'] != 1 + diff_size = len(inputs_data['s1:0']) - len(inputs_data['s0:0']) if diff_size > 0: # pad False elements to non_one_mask to the begin pad = np.full([diff_size], False, dtype=bool) @@ -29,9 +29,8 @@ class TestBroadcastArgs(CommonTFLayerTest): diff_size = abs(diff_size) non_one_mask = non_one_mask[diff_size:] update_inds = np.argwhere(non_one_mask) - inputs_data['s1'][update_inds] = 1 + inputs_data['s1:0'][update_inds] = 1 - print("inputs_data = ", inputs_data) return inputs_data def create_broadcast_args_net(self, s0_shape, s1_shape, input_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Bucketize.py b/tests/layer_tests/tensorflow_tests/test_tf_Bucketize.py index 3efd05746f2..720674fe09d 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Bucketize.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Bucketize.py @@ -11,12 +11,12 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestBucketize(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'input' in inputs_info, "Test error: inputs_info must contain `input`" - input_shape = inputs_info['input'] + assert 'input:0' in inputs_info, "Test error: inputs_info must contain `input`" + input_shape = inputs_info['input:0'] input_type = self.input_type inputs_data = {} input_data = np.random.randint(-20, 20, input_shape).astype(input_type) - inputs_data['input'] = input_data + inputs_data['input:0'] = input_data return inputs_data def create_bucketize_net(self, input_shape, input_type, boundaries_size): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_CheckNumerics.py b/tests/layer_tests/tensorflow_tests/test_tf_CheckNumerics.py index 95da161d81b..c178dac13f9 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_CheckNumerics.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_CheckNumerics.py @@ -14,13 +14,13 @@ OPS = { class TestCheckNumerics(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - x_shape = inputs_info['x'] - assert 'y' in inputs_info - y_shape = inputs_info['y'] + assert 'x:0' in inputs_info + x_shape = inputs_info['x:0'] + assert 'y:0' in inputs_info + y_shape = inputs_info['y:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) - inputs_data['y'] = np.random.randint(-10, 10, y_shape).astype(self.input_type) + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) + inputs_data['y:0'] = np.random.randint(-10, 10, y_shape).astype(self.input_type) return inputs_data def create_check_numerics_net(self, input_shape, input_type, op): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_ClipByValue.py b/tests/layer_tests/tensorflow_tests/test_tf_ClipByValue.py index 03705500ece..cb3818f2515 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_ClipByValue.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_ClipByValue.py @@ -9,14 +9,14 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestClipByValue(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 't' in inputs_info, "Test error: inputs_info must contain `t`" - t_shape = inputs_info['t'] - clip_value_min_shape = inputs_info['clip_value_min'] - clip_value_max_shape = inputs_info['clip_value_max'] + assert 't:0' in inputs_info, "Test error: inputs_info must contain `t`" + t_shape = inputs_info['t:0'] + clip_value_min_shape = inputs_info['clip_value_min:0'] + clip_value_max_shape = inputs_info['clip_value_max:0'] inputs_data = {} - inputs_data['t'] = np.random.randint(-10, 10, t_shape).astype(np.float32) - inputs_data['clip_value_min'] = np.random.randint(-10, 10, clip_value_min_shape).astype(np.float32) - inputs_data['clip_value_max'] = np.random.randint(-10, 10, clip_value_max_shape).astype(np.float32) + inputs_data['t:0'] = np.random.randint(-10, 10, t_shape).astype(np.float32) + inputs_data['clip_value_min:0'] = np.random.randint(-10, 10, clip_value_min_shape).astype(np.float32) + inputs_data['clip_value_max:0'] = np.random.randint(-10, 10, clip_value_max_shape).astype(np.float32) return inputs_data def create_clip_by_value_net(self, t_shape): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_ComplexFFT.py b/tests/layer_tests/tensorflow_tests/test_tf_ComplexFFT.py index 2fda3efd419..2891cc03ea0 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_ComplexFFT.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_ComplexFFT.py @@ -27,13 +27,13 @@ OPS = { class TestComplexFFT(CommonTFLayerTest): def _prepare_input(self, inputs_info): rng = np.random.default_rng() - assert 'param_real' in inputs_info - assert 'param_imag' in inputs_info - param_real_shape = inputs_info['param_real'] - param_imag_shape = inputs_info['param_imag'] + assert 'param_real:0' in inputs_info + assert 'param_imag:0' in inputs_info + param_real_shape = inputs_info['param_real:0'] + param_imag_shape = inputs_info['param_imag:0'] inputs_data = {} - inputs_data['param_real'] = 4 * rng.random(param_real_shape).astype(np.float32) - 2 - inputs_data['param_imag'] = 4 * rng.random(param_imag_shape).astype(np.float32) - 2 + inputs_data['param_real:0'] = 4 * rng.random(param_real_shape).astype(np.float32) - 2 + inputs_data['param_imag:0'] = 4 * rng.random(param_imag_shape).astype(np.float32) - 2 return inputs_data def create_complex_fft_net(self, input_shape, shift_roll, axis_roll, fft_op): @@ -88,13 +88,13 @@ class TestComplexFFT(CommonTFLayerTest): class TestComplexAbs(CommonTFLayerTest): def _prepare_input(self, inputs_info): rng = np.random.default_rng() - assert 'param_real' in inputs_info - assert 'param_imag' in inputs_info - param_real_shape = inputs_info['param_real'] - param_imag_shape = inputs_info['param_imag'] + assert 'param_real:0' in inputs_info + assert 'param_imag:0' in inputs_info + param_real_shape = inputs_info['param_real:0'] + param_imag_shape = inputs_info['param_imag:0'] inputs_data = {} - inputs_data['param_real'] = 4 * rng.random(param_real_shape).astype(np.float32) - 2 - inputs_data['param_imag'] = 4 * rng.random(param_imag_shape).astype(np.float32) - 2 + inputs_data['param_real:0'] = 4 * rng.random(param_real_shape).astype(np.float32) - 2 + inputs_data['param_imag:0'] = 4 * rng.random(param_imag_shape).astype(np.float32) - 2 return inputs_data def create_complex_abs_net(self, input_shape): @@ -131,10 +131,10 @@ class TestComplexAbs(CommonTFLayerTest): class TestComplexRFFT(CommonTFLayerTest): def _prepare_input(self, inputs_info): rng = np.random.default_rng() - assert 'param' in inputs_info - param_shape = inputs_info['param'] + assert 'param:0' in inputs_info + param_shape = inputs_info['param:0'] inputs_data = {} - inputs_data['param'] = 4 * rng.random(param_shape).astype(np.float32) - 2 + inputs_data['param:0'] = 4 * rng.random(param_shape).astype(np.float32) - 2 return inputs_data def create_complex_rfft_net(self, input_shape, fft_length, rfft_op): @@ -175,13 +175,13 @@ class TestComplexRFFT(CommonTFLayerTest): class TestComplexIRFFT(CommonTFLayerTest): def _prepare_input(self, inputs_info): rng = np.random.default_rng() - assert 'param_real' in inputs_info - assert 'param_imag' in inputs_info - param_real_shape = inputs_info['param_real'] - param_imag_shape = inputs_info['param_imag'] + assert 'param_real:0' in inputs_info + assert 'param_imag:0' in inputs_info + param_real_shape = inputs_info['param_real:0'] + param_imag_shape = inputs_info['param_imag:0'] inputs_data = {} - inputs_data['param_real'] = 4 * rng.random(param_real_shape).astype(np.float32) - 2 - inputs_data['param_imag'] = 4 * rng.random(param_imag_shape).astype(np.float32) - 2 + inputs_data['param_real:0'] = 4 * rng.random(param_real_shape).astype(np.float32) - 2 + inputs_data['param_imag:0'] = 4 * rng.random(param_imag_shape).astype(np.float32) - 2 return inputs_data def create_complex_irfft_net(self, input_shape, fft_length, irfft_op): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Conj.py b/tests/layer_tests/tensorflow_tests/test_tf_Conj.py index 445ceba7b1a..8f4f6099598 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Conj.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Conj.py @@ -14,14 +14,14 @@ class TestComplexConjugate(CommonTFLayerTest): def _prepare_input(self, inputs_info): rng = np.random.default_rng() - assert 'real_part' in inputs_info - real_part_shape = inputs_info['real_part'] - assert 'imag_part' in inputs_info - imag_part_shape = inputs_info['imag_part'] + assert 'real_part:0' in inputs_info + real_part_shape = inputs_info['real_part:0'] + assert 'imag_part:0' in inputs_info + imag_part_shape = inputs_info['imag_part:0'] inputs_data = {} - inputs_data['real_part'] = 4 * rng.random(real_part_shape).astype(np.float32) - 2 - inputs_data['imag_part'] = 4 * rng.random(imag_part_shape).astype(np.float32) - 2 + inputs_data['real_part:0'] = 4 * rng.random(real_part_shape).astype(np.float32) - 2 + inputs_data['imag_part:0'] = 4 * rng.random(imag_part_shape).astype(np.float32) - 2 return inputs_data def create_complex_conjugate_net(self, input_shape): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_ConjugateTranspose.py b/tests/layer_tests/tensorflow_tests/test_tf_ConjugateTranspose.py index 3634917fb1b..03c07e5c4b7 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_ConjugateTranspose.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_ConjugateTranspose.py @@ -15,14 +15,14 @@ class TestComplexConjugateTranspose(CommonTFLayerTest): def _prepare_input(self, inputs_info): rng = np.random.default_rng() - assert 'real_part' in inputs_info - real_part_shape = inputs_info['real_part'] - assert 'imag_part' in inputs_info - imag_part_shape = inputs_info['imag_part'] + assert 'real_part:0' in inputs_info + real_part_shape = inputs_info['real_part:0'] + assert 'imag_part:0' in inputs_info + imag_part_shape = inputs_info['imag_part:0'] inputs_data = {} - inputs_data['real_part'] = 4 * rng.random(real_part_shape).astype(np.float32) - 2 - inputs_data['imag_part'] = 4 * rng.random(imag_part_shape).astype(np.float32) - 2 + inputs_data['real_part:0'] = 4 * rng.random(real_part_shape).astype(np.float32) - 2 + inputs_data['imag_part:0'] = 4 * rng.random(imag_part_shape).astype(np.float32) - 2 return inputs_data @@ -75,11 +75,11 @@ class TestConjugateTranspose(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'input' in inputs_info - input_shape = inputs_info['input'] + assert 'input:0' in inputs_info + input_shape = inputs_info['input:0'] inputs_data = {} - inputs_data['input'] = np.random.default_rng().random(input_shape).astype(np.float32) + inputs_data['input:0'] = np.random.default_rng().random(input_shape).astype(np.float32) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_CropAndResize.py b/tests/layer_tests/tensorflow_tests/test_tf_CropAndResize.py index 6ecd0767610..00067f71f70 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_CropAndResize.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_CropAndResize.py @@ -11,17 +11,17 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestCropAndResize(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'image' in inputs_info, "Test error: inputs_info must contain `image`" + assert 'image:0' in inputs_info, "Test error: inputs_info must contain `image`" inputs_data = {} - image_shape = inputs_info['image'] - inputs_data['image'] = np.random.randint(-10, 10, image_shape).astype(np.float32) + image_shape = inputs_info['image:0'] + inputs_data['image:0'] = np.random.randint(-10, 10, image_shape).astype(np.float32) - if 'boxes' in inputs_info: - boxes_shape = inputs_info['boxes'] - inputs_data['boxes'] = np.random.randint(0, 1.2, boxes_shape).astype(np.float32) - if 'box_ind' in inputs_info: - box_ind_shape = inputs_info['box_ind'] - inputs_data['box_ind'] = np.random.randint(0, image_shape[0], box_ind_shape).astype(np.int32) + if 'boxes:0' in inputs_info: + boxes_shape = inputs_info['boxes:0'] + inputs_data['boxes:0'] = np.random.randint(0, 1.2, boxes_shape).astype(np.float32) + if 'box_ind:0' in inputs_info: + box_ind_shape = inputs_info['box_ind:0'] + inputs_data['box_ind:0'] = np.random.randint(0, image_shape[0], box_ind_shape).astype(np.int32) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Div.py b/tests/layer_tests/tensorflow_tests/test_tf_Div.py index 0687e291a26..ddaf9ed96ae 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Div.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Div.py @@ -9,14 +9,14 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestDiv(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - assert 'y' in inputs_info - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'x:0' in inputs_info + assert 'y:0' in inputs_info + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} # generate x and y - inputs_data['x'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) - inputs_data['y'] = np.random.randint(1, 10, y_shape)*np.random.choice([-1,1], y_shape) + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) + inputs_data['y:0'] = np.random.randint(1, 10, y_shape)*np.random.choice([-1,1], y_shape) return inputs_data def create_div_net(self, input_shape, input_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_DivNoNan.py b/tests/layer_tests/tensorflow_tests/test_tf_DivNoNan.py index a11fd524be8..34366559456 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_DivNoNan.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_DivNoNan.py @@ -11,14 +11,14 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestDivNoNan(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - assert 'y' in inputs_info - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'x:0' in inputs_info + assert 'y:0' in inputs_info + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) # generate y in way to have zeros - inputs_data['y'] = np.random.randint(-10, 10, y_shape).astype(self.input_type) * \ + inputs_data['y:0'] = np.random.randint(-10, 10, y_shape).astype(self.input_type) * \ np.random.randint(0, 2, y_shape).astype(self.input_type) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_DynamicPartition.py b/tests/layer_tests/tensorflow_tests/test_tf_DynamicPartition.py index 99e781cb59d..9e8e6a2245a 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_DynamicPartition.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_DynamicPartition.py @@ -9,14 +9,14 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestDynamicPartition(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'data' in inputs_info, "Test error: inputs_info must contain `data`" - assert 'partitions' in inputs_info, "Test error: inputs_info must contain `partitions`" - data_shape = inputs_info['data'] - partitions_shape = inputs_info['partitions'] + assert 'data:0' in inputs_info, "Test error: inputs_info must contain `data`" + assert 'partitions:0' in inputs_info, "Test error: inputs_info must contain `partitions`" + data_shape = inputs_info['data:0'] + partitions_shape = inputs_info['partitions:0'] inputs_data = {} - inputs_data['data'] = np.random.randint(-50, 50, data_shape) + inputs_data['data:0'] = np.random.randint(-50, 50, data_shape) # segment_ids data must be sorted according to TensorFlow SegmentSum specification - inputs_data['partitions'] = np.random.randint(0, 5, partitions_shape) + inputs_data['partitions:0'] = np.random.randint(0, 5, partitions_shape) return inputs_data def create_dynamic_partition_net(self, data_shape, partitions_shape, num_partitions, data_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_EnsureShape.py b/tests/layer_tests/tensorflow_tests/test_tf_EnsureShape.py index 8856a754124..2176313fcf7 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_EnsureShape.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_EnsureShape.py @@ -9,10 +9,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestEnsureShape(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'tensor' in inputs_info - tensor_shape = inputs_info['tensor'] + assert 'tensor:0' in inputs_info + tensor_shape = inputs_info['tensor:0'] inputs_data = {} - inputs_data['tensor'] = np.random.randint(-10, 10, tensor_shape).astype(self.input_type) + inputs_data['tensor:0'] = np.random.randint(-10, 10, tensor_shape).astype(self.input_type) return inputs_data def create_ensure_shape_net(self, input_shape, input_type, target_shape): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_ExpandDims.py b/tests/layer_tests/tensorflow_tests/test_tf_ExpandDims.py index d24bed4a950..65aeceaa9a0 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_ExpandDims.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_ExpandDims.py @@ -10,10 +10,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestExpandDims(CommonTFLayerTest): def _prepare_input(self, inputs_info): # generate elements so that the input tensor may contain repeating elements - assert 'input' in inputs_info, "Test error: inputs_info must contain `input`" - x_shape = inputs_info['input'] + assert 'input:0' in inputs_info, "Test error: inputs_info must contain `input`" + x_shape = inputs_info['input:0'] inputs_data = {} - inputs_data['input'] = np.random.randint(-10, 10, x_shape).astype(np.float32) + inputs_data['input:0'] = np.random.randint(-10, 10, x_shape).astype(np.float32) return inputs_data def create_expand_dims_net(self, input_shape, axis): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_ExtractImagePatches.py b/tests/layer_tests/tensorflow_tests/test_tf_ExtractImagePatches.py index 038d8cf81f0..c5538e8805d 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_ExtractImagePatches.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_ExtractImagePatches.py @@ -10,10 +10,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestExtractImagePatches(CommonTFLayerTest): def _prepare_input(self, inputs_info): # generate elements so that the input tensor may contain repeating elements - assert 'images' in inputs_info, "Test error: inputs_info must contain `images`" - images_shape = inputs_info['images'] + assert 'images:0' in inputs_info, "Test error: inputs_info must contain `images`" + images_shape = inputs_info['images:0'] inputs_data = {} - inputs_data['images'] = np.random.randint(-10, 10, images_shape).astype(np.float32) + inputs_data['images:0'] = np.random.randint(-10, 10, images_shape).astype(np.float32) return inputs_data def create_extract_image_patches_net(self, images_shape, ksizes, strides, rates, padding): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_FakeQuantWithMinMaxVars.py b/tests/layer_tests/tensorflow_tests/test_tf_FakeQuantWithMinMaxVars.py index 9a1ed8c9ed6..c19460349a9 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_FakeQuantWithMinMaxVars.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_FakeQuantWithMinMaxVars.py @@ -18,10 +18,10 @@ OPS = { class TestFakeQuantWithMinMaxVars(CommonTFLayerTest): def _prepare_input(self, inputs_info): # generate elements so that the input tensor may contain repeating elements - assert 'inputs' in inputs_info, "Test error: inputs_info must contain `input`" - inputs_shape = inputs_info['inputs'] + assert 'inputs:0' in inputs_info, "Test error: inputs_info must contain `input`" + inputs_shape = inputs_info['inputs:0'] inputs_data = {} - inputs_data['inputs'] = np.random.randint(-10, 10, inputs_shape).astype(np.float32) + inputs_data['inputs:0'] = np.random.randint(-10, 10, inputs_shape).astype(np.float32) return inputs_data def create_fake_quant_with_min_max_vars_net(self, inputs_shape, min_value, max_value, num_bits, narrow_range, diff --git a/tests/layer_tests/tensorflow_tests/test_tf_FusedBatchNorm.py b/tests/layer_tests/tensorflow_tests/test_tf_FusedBatchNorm.py index e357b316442..a1b85f11251 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_FusedBatchNorm.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_FusedBatchNorm.py @@ -12,18 +12,18 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestFusedBatchNorm(CommonTFLayerTest): def _prepare_input(self, inputs_info): inputs_data = {} - x_shape = inputs_info['x'] - inputs_data['x'] = np.random.randint(-10, 10, x_shape) - scale_shape = inputs_info['scale'] - inputs_data['scale'] = np.random.randint(-10, 10, scale_shape) - offset_shape = inputs_info['offset'] - inputs_data['offset'] = np.random.randint(-10, 10, offset_shape) - if 'mean' in inputs_info: - mean_shape = inputs_info['mean'] - inputs_data['mean'] = np.random.randint(-10, 10, mean_shape) - if 'variance' in inputs_info: - variance_shape = inputs_info['variance'] - inputs_data['variance'] = np.random.randint(0, 10, variance_shape) + x_shape = inputs_info['x:0'] + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape) + scale_shape = inputs_info['scale:0'] + inputs_data['scale:0'] = np.random.randint(-10, 10, scale_shape) + offset_shape = inputs_info['offset:0'] + inputs_data['offset:0'] = np.random.randint(-10, 10, offset_shape) + if 'mean:0' in inputs_info: + mean_shape = inputs_info['mean:0'] + inputs_data['mean:0'] = np.random.randint(-10, 10, mean_shape) + if 'variance:0' in inputs_info: + variance_shape = inputs_info['variance:0'] + inputs_data['variance:0'] = np.random.randint(0, 10, variance_shape) return inputs_data def create_fused_batch_norm_net(self, x_shape, epsilon, exponential_avg_factor, data_format, is_training, diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Gather.py b/tests/layer_tests/tensorflow_tests/test_tf_Gather.py index 50ff0237426..582a9710595 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Gather.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Gather.py @@ -11,17 +11,17 @@ rng = np.random.default_rng() class TestGather(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'params' in inputs_info - assert 'indices' in inputs_info - params_shape = inputs_info['params'] - indices_shape = inputs_info['indices'] + assert 'params:0' in inputs_info + assert 'indices:0' in inputs_info + params_shape = inputs_info['params:0'] + indices_shape = inputs_info['indices:0'] inputs_data = {} if self.params_type == str or self.params_type == np.str_: strings_dictionary = ['first', 'second sentence', ' sentence 3 three', '34ferf466 23435* '] - inputs_data['params'] = rng.choice(strings_dictionary, params_shape) + inputs_data['params:0'] = rng.choice(strings_dictionary, params_shape) else: - inputs_data['params'] = rng.integers(-50, 50, params_shape).astype(self.params_type) - inputs_data['indices'] = rng.integers(0, self.max_index, indices_shape).astype(self.indices_type) + inputs_data['params:0'] = rng.integers(-50, 50, params_shape).astype(self.params_type) + inputs_data['indices:0'] = rng.integers(0, self.max_index, indices_shape).astype(self.indices_type) return inputs_data def create_gather_net(self, params_shape, params_type, indices_shape, indices_type, axis_value, batch_dims, diff --git a/tests/layer_tests/tensorflow_tests/test_tf_GatherNd.py b/tests/layer_tests/tensorflow_tests/test_tf_GatherNd.py index aa24acabeef..49e1dbc0b28 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_GatherNd.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_GatherNd.py @@ -9,12 +9,12 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestGatherNd(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'params' in inputs_info - assert 'indices' in inputs_info - params_shape = inputs_info['params'] - indices_shape = list(inputs_info['indices']) + assert 'params:0' in inputs_info + assert 'indices:0' in inputs_info + params_shape = inputs_info['params:0'] + indices_shape = list(inputs_info['indices:0']) inputs_data = {} - inputs_data['params'] = np.random.randint(-50, 50, params_shape).astype(self.params_type) + inputs_data['params:0'] = np.random.randint(-50, 50, params_shape).astype(self.params_type) # generate indices for each slice and concatenate indices_slices = [] for idx in range(self.index_length): @@ -22,7 +22,7 @@ class TestGatherNd(CommonTFLayerTest): self.indices_type) indices_slices.append(indices_slice) indices_slice_rank = len(indices_slices[0].shape) - inputs_data['indices'] = np.concatenate(indices_slices, axis=indices_slice_rank - 1) + inputs_data['indices:0'] = np.concatenate(indices_slices, axis=indices_slice_rank - 1) return inputs_data def create_gather_nd_net(self, params_shape, params_type, indices_shape, indices_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_If.py b/tests/layer_tests/tensorflow_tests/test_tf_If.py index 107a3b5e998..a0428517a1a 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_If.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_If.py @@ -11,16 +11,16 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestIfFloat(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'cond' in inputs_info, "Test error: inputs_info must contain `cond`" - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - assert 'y' in inputs_info, "Test error: inputs_info must contain `y`" - cond_shape = inputs_info['cond'] - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'cond:0' in inputs_info, "Test error: inputs_info must contain `cond`" + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + assert 'y:0' in inputs_info, "Test error: inputs_info must contain `y`" + cond_shape = inputs_info['cond:0'] + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} - inputs_data['cond'] = np.random.randint(0, 2, cond_shape).astype(bool) - inputs_data['x'] = np.random.randint(1, 10, x_shape).astype(np.float32) - inputs_data['y'] = np.random.randint(-50, 50, y_shape).astype(np.float32) + inputs_data['cond:0'] = np.random.randint(0, 2, cond_shape).astype(bool) + inputs_data['x:0'] = np.random.randint(1, 10, x_shape).astype(np.float32) + inputs_data['y:0'] = np.random.randint(-50, 50, y_shape).astype(np.float32) return inputs_data def create_if_net(self, x_shape, y_shape, lower_control_flow): @@ -82,16 +82,16 @@ class TestIfFloat(CommonTFLayerTest): class TestIfInt(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'cond' in inputs_info, "Test error: inputs_info must contain `cond`" - assert 'ind' in inputs_info, "Test error: inputs_info must contain `ind`" - assert 'y' in inputs_info, "Test error: inputs_info must contain `y`" - cond_shape = inputs_info['cond'] - ind_shape = inputs_info['ind'] - y_shape = inputs_info['y'] + assert 'cond:0' in inputs_info, "Test error: inputs_info must contain `cond`" + assert 'ind:0' in inputs_info, "Test error: inputs_info must contain `ind`" + assert 'y:0' in inputs_info, "Test error: inputs_info must contain `y`" + cond_shape = inputs_info['cond:0'] + ind_shape = inputs_info['ind:0'] + y_shape = inputs_info['y:0'] inputs_data = {} - inputs_data['cond'] = np.random.randint(0, 2, cond_shape).astype(bool) - inputs_data['ind'] = np.random.randint(1, 10, ind_shape).astype(np.int32) - inputs_data['y'] = np.random.randint(-50, 50, y_shape).astype(np.float32) + inputs_data['cond:0'] = np.random.randint(0, 2, cond_shape).astype(bool) + inputs_data['ind:0'] = np.random.randint(1, 10, ind_shape).astype(np.int32) + inputs_data['y:0'] = np.random.randint(-50, 50, y_shape).astype(np.float32) return inputs_data def create_if_net(self, ind_shape, y_shape, lower_control_flow): @@ -154,16 +154,16 @@ class TestIfInt(CommonTFLayerTest): class TestNestedIf(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `cond`" - assert 'y' in inputs_info, "Test error: inputs_info must contain `x`" - assert 'z' in inputs_info, "Test error: inputs_info must contain `y`" - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] - z_shape = inputs_info['z'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `cond`" + assert 'y:0' in inputs_info, "Test error: inputs_info must contain `x`" + assert 'z:0' in inputs_info, "Test error: inputs_info must contain `y`" + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] + z_shape = inputs_info['z:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(0, 6, x_shape).astype(np.int32) - inputs_data['y'] = np.random.randint(1, 10, y_shape).astype(np.float32) - inputs_data['z'] = np.random.randint(-50, 50, z_shape).astype(np.float32) + inputs_data['x:0'] = np.random.randint(0, 6, x_shape).astype(np.int32) + inputs_data['y:0'] = np.random.randint(1, 10, y_shape).astype(np.float32) + inputs_data['z:0'] = np.random.randint(-50, 50, z_shape).astype(np.float32) return inputs_data def create_if_net(self, y_shape, z_shape, lower_control_flow): @@ -234,16 +234,16 @@ class TestNestedIf(CommonTFLayerTest): class TestSequantialIfs(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'cond' in inputs_info, "Test error: inputs_info must contain `cond`" - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - assert 'y' in inputs_info, "Test error: inputs_info must contain `y`" - cond_shape = inputs_info['cond'] - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'cond:0' in inputs_info, "Test error: inputs_info must contain `cond`" + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + assert 'y:0' in inputs_info, "Test error: inputs_info must contain `y`" + cond_shape = inputs_info['cond:0'] + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} - inputs_data['cond'] = np.random.randint(0, 2, cond_shape).astype(bool) - inputs_data['x'] = np.random.randint(1, 10, x_shape).astype(np.float32) - inputs_data['y'] = np.random.randint(-50, 50, y_shape).astype(np.float32) + inputs_data['cond:0'] = np.random.randint(0, 2, cond_shape).astype(bool) + inputs_data['x:0'] = np.random.randint(1, 10, x_shape).astype(np.float32) + inputs_data['y:0'] = np.random.randint(-50, 50, y_shape).astype(np.float32) return inputs_data def create_sequential_ifs_net(self, x_shape, y_shape, lower_control_flow): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Inv.py b/tests/layer_tests/tensorflow_tests/test_tf_Inv.py index ceb2eb11335..d2350f9841f 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Inv.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Inv.py @@ -9,10 +9,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestInv(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info + x_shape = inputs_info['x:0'] inputs_data = {} - inputs_data['x'] = np.random.choice([-5, -4, -3, -2, -1, 1, 2, 3, 4, 5], x_shape).astype(np.float32) + inputs_data['x:0'] = np.random.choice([-5, -4, -3, -2, -1, 1, 2, 3, 4, 5], x_shape).astype(np.float32) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_InvertPermutation.py b/tests/layer_tests/tensorflow_tests/test_tf_InvertPermutation.py index 937093cc612..cb613093a80 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_InvertPermutation.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_InvertPermutation.py @@ -9,11 +9,11 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestInvertPermutation(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info + x_shape = inputs_info['x:0'] rng = np.random.default_rng() inputs_data = {} - inputs_data['x'] = rng.permutation(x_shape[0]).astype(self.input_type) + inputs_data['x:0'] = rng.permutation(x_shape[0]).astype(self.input_type) return inputs_data def create_invert_permutation_net(self, input_shape, input_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_IsFinite.py b/tests/layer_tests/tensorflow_tests/test_tf_IsFinite.py index 69d9e24cbbd..e4740a2aa78 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_IsFinite.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_IsFinite.py @@ -10,13 +10,13 @@ from common.utils.tf_utils import mix_array_with_value class TestIsFinite(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + x_shape = inputs_info['x:0'] inputs_data = {} data = np.random.randint(-50, 50, x_shape).astype(np.float32) # mix data with np.inf and np.nan data = mix_array_with_value(data, np.nan) - inputs_data['x'] = mix_array_with_value(data, np.inf) + inputs_data['x:0'] = mix_array_with_value(data, np.inf) return inputs_data def create_is_finite_net(self, x_shape, x_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_IsInf.py b/tests/layer_tests/tensorflow_tests/test_tf_IsInf.py index d01912b56eb..1a9a89d0703 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_IsInf.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_IsInf.py @@ -10,11 +10,11 @@ from common.utils.tf_utils import mix_array_with_value class TestIsInf(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `data`" - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `data`" + x_shape = inputs_info['x:0'] inputs_data = {} data = np.random.randint(-50, 50, x_shape).astype(np.float32) - inputs_data['x'] = mix_array_with_value(data, np.inf) + inputs_data['x:0'] = mix_array_with_value(data, np.inf) return inputs_data def create_is_inf_net(self, x_shape, x_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_IsNan.py b/tests/layer_tests/tensorflow_tests/test_tf_IsNan.py index 322db14cc72..0afbc83ebf7 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_IsNan.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_IsNan.py @@ -10,13 +10,13 @@ from common.utils.tf_utils import mix_array_with_value class TestIsNan(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `data`" - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `data`" + x_shape = inputs_info['x:0'] inputs_data = {} data = np.random.randint(-50, 50, x_shape).astype(np.float32) # mix data with np.inf and np.nan data = mix_array_with_value(data, np.nan) - inputs_data['x'] = mix_array_with_value(data, np.inf) + inputs_data['x:0'] = mix_array_with_value(data, np.inf) return inputs_data def create_is_nan_net(self, x_shape, x_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_ListDiff.py b/tests/layer_tests/tensorflow_tests/test_tf_ListDiff.py index 5f187452ca5..2fe151af5e7 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_ListDiff.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_ListDiff.py @@ -9,13 +9,13 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestListDiff(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - assert 'y' in inputs_info, "Test error: inputs_info must contain `y`" - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + assert 'y:0' in inputs_info, "Test error: inputs_info must contain `y`" + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(-5, 5, x_shape) - inputs_data['y'] = np.random.randint(-5, 5, y_shape) + inputs_data['x:0'] = np.random.randint(-5, 5, x_shape) + inputs_data['y:0'] = np.random.randint(-5, 5, y_shape) return inputs_data def create_list_diff_net(self, x_shape, y_shape, out_idx): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Log1p.py b/tests/layer_tests/tensorflow_tests/test_tf_Log1p.py index 0d6345c6497..ee16758cd26 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Log1p.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Log1p.py @@ -9,10 +9,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestLog1p(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info + x_shape = inputs_info['x:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(-0.9, 5, x_shape).astype(np.float32) + inputs_data['x:0'] = np.random.randint(-0.9, 5, x_shape).astype(np.float32) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_LookupTableFind.py b/tests/layer_tests/tensorflow_tests/test_tf_LookupTableFind.py index 5b170dc5c53..6f4a0c3b272 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_LookupTableFind.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_LookupTableFind.py @@ -12,12 +12,12 @@ rng = np.random.default_rng() class TestLookupTableFindOps(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'keys' in inputs_info, "Test error: inputs_info must contain `x`" - keys_shape = inputs_info['keys'] + assert 'keys:0' in inputs_info, "Test error: inputs_info must contain `x`" + keys_shape = inputs_info['keys:0'] inputs_data = {} if np.issubdtype(self.keys_type, np.integer): data = rng.choice(self.all_keys, keys_shape) - inputs_data['keys'] = mix_array_with_value(data, self.invalid_key) + inputs_data['keys:0'] = mix_array_with_value(data, self.invalid_key) else: raise "Unsupported type {}".format(self.keys_type) diff --git a/tests/layer_tests/tensorflow_tests/test_tf_MatrixDiag.py b/tests/layer_tests/tensorflow_tests/test_tf_MatrixDiag.py index 71f92e433ef..2fc522c8445 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_MatrixDiag.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_MatrixDiag.py @@ -9,10 +9,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestMatrixDiag(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'diagonal' in inputs_info - diagonal_shape = inputs_info['diagonal'] + assert 'diagonal:0' in inputs_info + diagonal_shape = inputs_info['diagonal:0'] inputs_data = {} - inputs_data['diagonal'] = np.random.randint(-50, 50, diagonal_shape).astype(self.diagonal_type) + inputs_data['diagonal:0'] = np.random.randint(-50, 50, diagonal_shape).astype(self.diagonal_type) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_MaxPoolWithArgmax.py b/tests/layer_tests/tensorflow_tests/test_tf_MaxPoolWithArgmax.py index c9b67ce33b4..2728ac9f1fa 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_MaxPoolWithArgmax.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_MaxPoolWithArgmax.py @@ -11,10 +11,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestMaxPoolWithArgmax(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'input' in inputs_info - input_shape = inputs_info['input'] + assert 'input:0' in inputs_info + input_shape = inputs_info['input:0'] inputs_data = {} - inputs_data['input'] = np.random.randint(-5, 5, input_shape).astype(self.input_type) + inputs_data['input:0'] = np.random.randint(-5, 5, input_shape).astype(self.input_type) return inputs_data def create_max_pool_with_argmax_net(self, input_shape, ksize, strides, input_type, padding, targmax, diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Mul.py b/tests/layer_tests/tensorflow_tests/test_tf_Mul.py index 4ff4b9b48db..b85ba51b8d6 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Mul.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Mul.py @@ -218,19 +218,19 @@ class TestMul(CommonTFLayerTest): class TestComplexMul(CommonTFLayerTest): def _prepare_input(self, inputs_info): rng = np.random.default_rng() - assert 'param_real_1' in inputs_info - assert 'param_imag_1' in inputs_info - assert 'param_real_2' in inputs_info - assert 'param_imag_2' in inputs_info - param_real_shape_1 = inputs_info['param_real_1'] - param_imag_shape_1 = inputs_info['param_imag_1'] - param_real_shape_2 = inputs_info['param_real_2'] - param_imag_shape_2 = inputs_info['param_imag_2'] + assert 'param_real_1:0' in inputs_info + assert 'param_imag_1:0' in inputs_info + assert 'param_real_2:0' in inputs_info + assert 'param_imag_2:0' in inputs_info + param_real_shape_1 = inputs_info['param_real_1:0'] + param_imag_shape_1 = inputs_info['param_imag_1:0'] + param_real_shape_2 = inputs_info['param_real_2:0'] + param_imag_shape_2 = inputs_info['param_imag_2:0'] inputs_data = {} - inputs_data['param_real_1'] = 4 * rng.random(param_real_shape_1).astype(np.float32) - 2 - inputs_data['param_imag_1'] = 4 * rng.random(param_imag_shape_1).astype(np.float32) - 2 - inputs_data['param_real_2'] = 4 * rng.random(param_real_shape_2).astype(np.float32) - 2 - inputs_data['param_imag_2'] = 4 * rng.random(param_imag_shape_2).astype(np.float32) - 2 + inputs_data['param_real_1:0'] = 4 * rng.random(param_real_shape_1).astype(np.float32) - 2 + inputs_data['param_imag_1:0'] = 4 * rng.random(param_imag_shape_1).astype(np.float32) - 2 + inputs_data['param_real_2:0'] = 4 * rng.random(param_real_shape_2).astype(np.float32) - 2 + inputs_data['param_imag_2:0'] = 4 * rng.random(param_imag_shape_2).astype(np.float32) - 2 return inputs_data def create_complex_mul_net(self, input_shape): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_MulNoNan.py b/tests/layer_tests/tensorflow_tests/test_tf_MulNoNan.py index ac93f04b01f..ba124734c4f 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_MulNoNan.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_MulNoNan.py @@ -9,15 +9,15 @@ from common.utils.tf_utils import mix_array_with_value class TestMulNoNan(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - assert 'y' in inputs_info - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'x:0' in inputs_info + assert 'y:0' in inputs_info + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) - inputs_data['x'] = mix_array_with_value(inputs_data['x'], np.inf) - inputs_data['x'] = mix_array_with_value(inputs_data['x'], np.nan) - inputs_data['y'] = np.random.randint(-10, 10, y_shape).astype(self.input_type) * \ + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) + inputs_data['x:0'] = mix_array_with_value(inputs_data['x:0'], np.inf) + inputs_data['x:0'] = mix_array_with_value(inputs_data['x:0'], np.nan) + inputs_data['y:0'] = np.random.randint(-10, 10, y_shape).astype(self.input_type) * \ np.random.choice([0.0], y_shape).astype(self.input_type) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Multinomial.py b/tests/layer_tests/tensorflow_tests/test_tf_Multinomial.py index f6afc65b724..b62067867e6 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Multinomial.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Multinomial.py @@ -9,8 +9,8 @@ import numpy as np class TestMultinomial(CommonTFLayerTest): def _prepare_input(self, inputs_dict, kwargs): - inputs_dict["num_samples"] = np.array(kwargs["num_samples"], dtype=np.int32) - inputs_dict["probs"] = kwargs["input"] + inputs_dict["num_samples:0"] = np.array(kwargs["num_samples:0"], dtype=np.int32) + inputs_dict["probs:0"] = kwargs["input:0"] return inputs_dict def create_tf_multinomial_net_shape( @@ -138,5 +138,5 @@ class TestMultinomial(CommonTFLayerTest): temp_dir=temp_dir, ir_version=ir_version, use_legacy_frontend=use_legacy_frontend, - kwargs_to_prepare_input={"input": input, "num_samples": num_samples}, + kwargs_to_prepare_input={"input:0": input, "num_samples:0": num_samples}, ) diff --git a/tests/layer_tests/tensorflow_tests/test_tf_NonMaxSupression.py b/tests/layer_tests/tensorflow_tests/test_tf_NonMaxSupression.py index 9ceb5d63a24..771a8302991 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_NonMaxSupression.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_NonMaxSupression.py @@ -14,10 +14,9 @@ class TestNonMaxSuppression(CommonTFLayerTest): # overload inputs generation to suit NMS use case def _prepare_input(self, inputs_dict): - channel = ':0' if not self.use_legacy_frontend else '' input_data = {} for input in inputs_dict.keys(): - input_data[input + channel] = np.random.uniform(low=0, high=1, + input_data[input] = np.random.uniform(low=0, high=1, size=inputs_dict[input]).astype(np.float32) return input_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_OnesLike.py b/tests/layer_tests/tensorflow_tests/test_tf_OnesLike.py index f13a6d0d79d..0b29db87e2a 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_OnesLike.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_OnesLike.py @@ -9,11 +9,11 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestOnesLike(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info + x_shape = inputs_info['x:0'] inputs_data = {} rng = np.random.default_rng() - inputs_data['x'] = rng.integers(-10, 10, x_shape).astype(self.x_type) + inputs_data['x:0'] = rng.integers(-10, 10, x_shape).astype(self.x_type) return inputs_data def create_ones_like_net(self, x_shape, x_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Pad.py b/tests/layer_tests/tensorflow_tests/test_tf_Pad.py index 07ed7d9ae30..9e8455632d5 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Pad.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Pad.py @@ -48,13 +48,13 @@ class TestPad(CommonTFLayerTest): class TestComplexPad(CommonTFLayerTest): def _prepare_input(self, inputs_info): rng = np.random.default_rng() - assert 'param_real' in inputs_info - assert 'param_imag' in inputs_info - param_real_shape = inputs_info['param_real'] - param_imag_shape = inputs_info['param_imag'] + assert 'param_real:0' in inputs_info + assert 'param_imag:0' in inputs_info + param_real_shape = inputs_info['param_real:0'] + param_imag_shape = inputs_info['param_imag:0'] inputs_data = {} - inputs_data['param_real'] = 4 * rng.random(param_real_shape).astype(np.float32) - 2 - inputs_data['param_imag'] = 4 * rng.random(param_imag_shape).astype(np.float32) - 2 + inputs_data['param_real:0'] = 4 * rng.random(param_real_shape).astype(np.float32) - 2 + inputs_data['param_imag:0'] = 4 * rng.random(param_imag_shape).astype(np.float32) - 2 return inputs_data def create_pad_complex_net(self, input_shape, pads_values): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_ParallelDynamicStitch.py b/tests/layer_tests/tensorflow_tests/test_tf_ParallelDynamicStitch.py index 5c951f6ea51..346f86835ba 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_ParallelDynamicStitch.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_ParallelDynamicStitch.py @@ -14,7 +14,7 @@ class TestParallelDynamicStitch(CommonTFLayerTest): assert len(inputs_info) % 2 == 0, "Number of inputs should be divisible by 2." data_input_cnt = len(inputs_info)//2 for i in range(1, data_input_cnt + 1): - indices_in_name = "indices{}".format(i) + indices_in_name = "indices{}:0".format(i) assert indices_in_name in inputs_info, "Test error: inputs_info must contain `{}`".format(indices_in_name) indices_shape = inputs_info[indices_in_name] num_elements = num_elements + np.prod(indices_shape, dtype=int) @@ -28,8 +28,8 @@ class TestParallelDynamicStitch(CommonTFLayerTest): idx = 0 for i in range(1, data_input_cnt + 1): - data_in_name = "data{}".format(i) - indices_in_name = "indices{}".format(i) + data_in_name = "data{}:0".format(i) + indices_in_name = "indices{}:0".format(i) assert data_in_name in inputs_info, "Test error: inputs_info must contain `{}`".format(data_in_name) data_shape = inputs_info[data_in_name] indices_shape = inputs_info[indices_in_name] diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Placeholder.py b/tests/layer_tests/tensorflow_tests/test_tf_Placeholder.py index f7345b6bbad..7b00454f89f 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Placeholder.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Placeholder.py @@ -36,7 +36,6 @@ class TestPlaceholder(CommonTFLayerTest): # Create the graph and model with tf.compat.v1.Session() as sess: x = tf.raw_ops.Placeholder(dtype=dtype, shape=input_shape, name='x') - tf.raw_ops.Identity(input=x, name='Identityrfefef') tf.compat.v1.global_variables_initializer() tf_net = sess.graph_def diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Range.py b/tests/layer_tests/tensorflow_tests/test_tf_Range.py index 8cff534a995..77657df2390 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Range.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Range.py @@ -11,13 +11,13 @@ class TestRange(CommonTFLayerTest): def _prepare_input(self, inputs_info): inputs_data = {} if self.negative_delta: - inputs_data['start'] = np.random.randint(1, 10, []).astype(self.input_type) - inputs_data['limit'] = np.random.randint(-10, 0, []).astype(self.input_type) - inputs_data['delta'] = np.random.randint(-5, -1, []).astype(self.input_type) + inputs_data['start:0'] = np.random.randint(1, 10, []).astype(self.input_type) + inputs_data['limit:0'] = np.random.randint(-10, 0, []).astype(self.input_type) + inputs_data['delta:0'] = np.random.randint(-5, -1, []).astype(self.input_type) else: - inputs_data['start'] = np.random.randint(1, 10, []).astype(self.input_type) - inputs_data['limit'] = np.random.randint(10, 30, []).astype(self.input_type) - inputs_data['delta'] = np.random.randint(1, 5, []).astype(self.input_type) + inputs_data['start:0'] = np.random.randint(1, 10, []).astype(self.input_type) + inputs_data['limit:0'] = np.random.randint(10, 30, []).astype(self.input_type) + inputs_data['delta:0'] = np.random.randint(1, 5, []).astype(self.input_type) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Reciprocal.py b/tests/layer_tests/tensorflow_tests/test_tf_Reciprocal.py index 69aada55c9f..90953c4d550 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Reciprocal.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Reciprocal.py @@ -9,10 +9,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestReciprocal(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info + x_shape = inputs_info['x:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(1, 30, x_shape).astype(np.float32) + inputs_data['x:0'] = np.random.randint(1, 30, x_shape).astype(np.float32) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_ReduceArithmeticOps.py b/tests/layer_tests/tensorflow_tests/test_tf_ReduceArithmeticOps.py index c7c9ad3c8f1..fdebbd268bb 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_ReduceArithmeticOps.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_ReduceArithmeticOps.py @@ -8,10 +8,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestReduceArithmeticOps(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'input' in inputs_info, "Test error: inputs_info must contain `input`" - x_shape = inputs_info['input'] + assert 'input:0' in inputs_info, "Test error: inputs_info must contain `input`" + x_shape = inputs_info['input:0'] inputs_data = {} - inputs_data['input'] = np.random.randint(-10, 10, x_shape).astype(np.float32) + inputs_data['input:0'] = np.random.randint(-10, 10, x_shape).astype(np.float32) return inputs_data def create_reduce_net(self, shape, axis, operation, keep_dims, ir_version, use_legacy_frontend): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Reshape.py b/tests/layer_tests/tensorflow_tests/test_tf_Reshape.py index aa8b70784f3..9594efef86d 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Reshape.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Reshape.py @@ -9,10 +9,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestReshape(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'tensor' in inputs_info - tensor_shape = inputs_info['tensor'] + assert 'tensor:0' in inputs_info + tensor_shape = inputs_info['tensor:0'] inputs_data = {} - inputs_data['tensor'] = np.random.randint(-10, 10, tensor_shape).astype(self.input_type) + inputs_data['tensor:0'] = np.random.randint(-10, 10, tensor_shape).astype(self.input_type) return inputs_data @@ -53,13 +53,13 @@ class TestReshape(CommonTFLayerTest): class TestComplexReshape(CommonTFLayerTest): def _prepare_input(self, inputs_info): rng = np.random.default_rng() - assert 'param_real' in inputs_info - assert 'param_imag' in inputs_info - param_real_shape_1 = inputs_info['param_real'] - param_imag_shape_1 = inputs_info['param_imag'] + assert 'param_real:0' in inputs_info + assert 'param_imag:0' in inputs_info + param_real_shape_1 = inputs_info['param_real:0'] + param_imag_shape_1 = inputs_info['param_imag:0'] inputs_data = {} - inputs_data['param_real'] = 4 * rng.random(param_real_shape_1).astype(np.float32) - 2 - inputs_data['param_imag'] = 4 * rng.random(param_imag_shape_1).astype(np.float32) - 2 + inputs_data['param_real:0'] = 4 * rng.random(param_real_shape_1).astype(np.float32) - 2 + inputs_data['param_imag:0'] = 4 * rng.random(param_imag_shape_1).astype(np.float32) - 2 return inputs_data def create_complex_transpose_net(self, input_shape, target_shape): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Resize.py b/tests/layer_tests/tensorflow_tests/test_tf_Resize.py index 2afae4a8d7f..e1608dd7594 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Resize.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Resize.py @@ -16,10 +16,10 @@ OPS = { class TestResize(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'images' in inputs_info, "Test error: inputs_info must contain `x`" - images_shape = inputs_info['images'] + assert 'images:0' in inputs_info, "Test error: inputs_info must contain `x`" + images_shape = inputs_info['images:0'] inputs_data = {} - inputs_data['images'] = np.random.randint(0, 10, images_shape) + inputs_data['images:0'] = np.random.randint(0, 10, images_shape) return inputs_data def create_resize_net(self, images_shape, images_type, size_value, align_corners, half_pixel_centers, diff --git a/tests/layer_tests/tensorflow_tests/test_tf_ReverseSequence.py b/tests/layer_tests/tensorflow_tests/test_tf_ReverseSequence.py index fe1dbffdd22..d4f3a61a4bc 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_ReverseSequence.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_ReverseSequence.py @@ -9,13 +9,13 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestReverseSequence(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'input' in inputs_info - assert 'seq_lengths' in inputs_info - input_shape = inputs_info['input'] - seq_lengths_shape = inputs_info['seq_lengths'] + assert 'input:0' in inputs_info + assert 'seq_lengths:0' in inputs_info + input_shape = inputs_info['input:0'] + seq_lengths_shape = inputs_info['seq_lengths:0'] inputs_data = {} - inputs_data['input'] = np.random.randint(-50, 50, input_shape).astype(self.input_type) - inputs_data['seq_lengths'] = np.random.randint(0, self.max_seq_length + 1, seq_lengths_shape).astype( + inputs_data['input:0'] = np.random.randint(-50, 50, input_shape).astype(self.input_type) + inputs_data['seq_lengths:0'] = np.random.randint(0, self.max_seq_length + 1, seq_lengths_shape).astype( self.seq_lengths_type) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_SegmentSum.py b/tests/layer_tests/tensorflow_tests/test_tf_SegmentSum.py index 81a64eb165c..7b1c9267a81 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_SegmentSum.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_SegmentSum.py @@ -11,14 +11,14 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestSegmentSum(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'data' in inputs_info, "Test error: inputs_info must contain `data`" - assert 'segment_ids' in inputs_info, "Test error: inputs_info must contain `segment_ids`" - data_shape = inputs_info['data'] - segment_ids_shape = inputs_info['segment_ids'] + assert 'data:0' in inputs_info, "Test error: inputs_info must contain `data`" + assert 'segment_ids:0' in inputs_info, "Test error: inputs_info must contain `segment_ids`" + data_shape = inputs_info['data:0'] + segment_ids_shape = inputs_info['segment_ids:0'] inputs_data = {} - inputs_data['data'] = np.random.randint(-50, 50, data_shape) + inputs_data['data:0'] = np.random.randint(-50, 50, data_shape) # segment_ids data must be sorted according to TensorFlow SegmentSum specification - inputs_data['segment_ids'] = np.sort(np.random.randint(0, 20, segment_ids_shape)) + inputs_data['segment_ids:0'] = np.sort(np.random.randint(0, 20, segment_ids_shape)) return inputs_data def create_segment_sum_net(self, data_shape, segment_ids_shape, data_type, segment_ids_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Select.py b/tests/layer_tests/tensorflow_tests/test_tf_Select.py index 1715c354c21..aa1a31b05af 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Select.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Select.py @@ -9,16 +9,16 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestSelect(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'cond' in inputs_info, "Test error: inputs_info must contain `cond`" - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - assert 'y' in inputs_info, "Test error: inputs_info must contain `y`" - cond_shape = inputs_info['cond'] - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'cond:0' in inputs_info, "Test error: inputs_info must contain `cond`" + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + assert 'y:0' in inputs_info, "Test error: inputs_info must contain `y`" + cond_shape = inputs_info['cond:0'] + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} - inputs_data['cond'] = np.random.randint(0, 2, cond_shape).astype(bool) - inputs_data['x'] = np.random.randint(-100, 100, x_shape).astype(np.float32) - inputs_data['y'] = np.random.randint(-100, 100, y_shape).astype(np.float32) + inputs_data['cond:0'] = np.random.randint(0, 2, cond_shape).astype(bool) + inputs_data['x:0'] = np.random.randint(-100, 100, x_shape).astype(np.float32) + inputs_data['y:0'] = np.random.randint(-100, 100, y_shape).astype(np.float32) return inputs_data def create_select_net(self, cond_shape, x_shape, y_shape): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_SelectV2.py b/tests/layer_tests/tensorflow_tests/test_tf_SelectV2.py index 85515a44ef3..26d31ba6c66 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_SelectV2.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_SelectV2.py @@ -9,16 +9,16 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestSelectV2(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'cond' in inputs_info, "Test error: inputs_info must contain `cond`" - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - assert 'y' in inputs_info, "Test error: inputs_info must contain `y`" - cond_shape = inputs_info['cond'] - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'cond:0' in inputs_info, "Test error: inputs_info must contain `cond`" + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + assert 'y:0' in inputs_info, "Test error: inputs_info must contain `y`" + cond_shape = inputs_info['cond:0'] + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} - inputs_data['cond'] = np.random.randint(0, 2, cond_shape).astype(bool) - inputs_data['x'] = np.random.randint(-100, 100, x_shape).astype(np.float32) - inputs_data['y'] = np.random.randint(-100, 100, y_shape).astype(np.float32) + inputs_data['cond:0'] = np.random.randint(0, 2, cond_shape).astype(bool) + inputs_data['x:0'] = np.random.randint(-100, 100, x_shape).astype(np.float32) + inputs_data['y:0'] = np.random.randint(-100, 100, y_shape).astype(np.float32) return inputs_data def create_select_v2_net(self, cond_shape, x_shape, y_shape): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Shape.py b/tests/layer_tests/tensorflow_tests/test_tf_Shape.py index ec3314feac9..c9871ec5072 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Shape.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Shape.py @@ -9,17 +9,17 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestShape(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'input' in inputs_info - input_shape = inputs_info['input'] + assert 'input:0' in inputs_info + input_shape = inputs_info['input:0'] inputs_data = {} rng = np.random.default_rng() if self.input_type == str or self.input_type == np.str_: strings_dictionary = ['first', 'second sentence', ' sentence 3 three', '34ferf466 23435* ', '汉语句子', 'Oferta polska', 'предложение по-русски'] - inputs_data['input'] = rng.choice(strings_dictionary, input_shape) + inputs_data['input:0'] = rng.choice(strings_dictionary, input_shape) else: - inputs_data['input'] = rng.integers(-10, 10, size=input_shape).astype(self.input_type) + inputs_data['input:0'] = rng.integers(-10, 10, size=input_shape).astype(self.input_type) return inputs_data def create_shape_net(self, input_shape, input_type, out_type): @@ -62,13 +62,13 @@ class TestShape(CommonTFLayerTest): class TestComplexShape(CommonTFLayerTest): def _prepare_input(self, inputs_info): rng = np.random.default_rng() - assert 'param_real' in inputs_info - assert 'param_imag' in inputs_info - param_real_shape_1 = inputs_info['param_real'] - param_imag_shape_1 = inputs_info['param_imag'] + assert 'param_real:0' in inputs_info + assert 'param_imag:0' in inputs_info + param_real_shape_1 = inputs_info['param_real:0'] + param_imag_shape_1 = inputs_info['param_imag:0'] inputs_data = {} - inputs_data['param_real'] = 4 * rng.random(param_real_shape_1).astype(np.float32) - 2 - inputs_data['param_imag'] = 4 * rng.random(param_imag_shape_1).astype(np.float32) - 2 + inputs_data['param_real:0'] = 4 * rng.random(param_real_shape_1).astype(np.float32) - 2 + inputs_data['param_imag:0'] = 4 * rng.random(param_imag_shape_1).astype(np.float32) - 2 return inputs_data def create_complex_shape_net(self, input_shape): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Size.py b/tests/layer_tests/tensorflow_tests/test_tf_Size.py index 88971c589b0..0622625e78a 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Size.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Size.py @@ -9,11 +9,11 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestSize(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'input' in inputs_info - input_shape = inputs_info['input'] + assert 'input:0' in inputs_info + input_shape = inputs_info['input:0'] input_type = self.input_type inputs_data = {} - inputs_data['input'] = np.random.randint(-50, 50, input_shape).astype(input_type) + inputs_data['input:0'] = np.random.randint(-50, 50, input_shape).astype(input_type) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Softmax.py b/tests/layer_tests/tensorflow_tests/test_tf_Softmax.py index dd8e542cb26..ca3541a055a 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Softmax.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Softmax.py @@ -11,10 +11,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestSoftmax(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'logits' in inputs_info - logits_shape = inputs_info['logits'] + assert 'logits:0' in inputs_info + logits_shape = inputs_info['logits:0'] inputs_data = {} - inputs_data['logits'] = np.random.randint(-5, 5, logits_shape).astype(np.float32) + inputs_data['logits:0'] = np.random.randint(-5, 5, logits_shape).astype(np.float32) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Squeeze.py b/tests/layer_tests/tensorflow_tests/test_tf_Squeeze.py index 606bb2ba696..dec66701289 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Squeeze.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Squeeze.py @@ -9,10 +9,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestSqueeze(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'input' in inputs_info - input_shape = inputs_info['input'] + assert 'input:0' in inputs_info + input_shape = inputs_info['input:0'] inputs_data = {} - inputs_data['input'] = np.random.randint(-50, 50, input_shape).astype(self.input_type) + inputs_data['input:0'] = np.random.randint(-50, 50, input_shape).astype(self.input_type) return inputs_data @@ -114,13 +114,13 @@ class TestSqueeze(CommonTFLayerTest): class TestComplexSqueeze(CommonTFLayerTest): def _prepare_input(self, inputs_info): rng = np.random.default_rng() - assert 'param_real' in inputs_info - assert 'param_imag' in inputs_info - param_real_shape_1 = inputs_info['param_real'] - param_imag_shape_1 = inputs_info['param_imag'] + assert 'param_real:0' in inputs_info + assert 'param_imag:0' in inputs_info + param_real_shape_1 = inputs_info['param_real:0'] + param_imag_shape_1 = inputs_info['param_imag:0'] inputs_data = {} - inputs_data['param_real'] = 4 * rng.random(param_real_shape_1).astype(np.float32) - 2 - inputs_data['param_imag'] = 4 * rng.random(param_imag_shape_1).astype(np.float32) - 2 + inputs_data['param_real:0'] = 4 * rng.random(param_real_shape_1).astype(np.float32) - 2 + inputs_data['param_imag:0'] = 4 * rng.random(param_imag_shape_1).astype(np.float32) - 2 return inputs_data def create_complex_squeeze_net(self, input_shape, axis): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_StridedSlice.py b/tests/layer_tests/tensorflow_tests/test_tf_StridedSlice.py index abf09a3c352..855590084a7 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_StridedSlice.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_StridedSlice.py @@ -123,13 +123,13 @@ class TestComplexStridedSlice(CommonTFLayerTest): def _prepare_input(self, inputs_info): import numpy as np rng = np.random.default_rng() - assert 'param_real' in inputs_info - assert 'param_imag' in inputs_info - param_real_shape_1 = inputs_info['param_real'] - param_imag_shape_1 = inputs_info['param_imag'] + assert 'param_real:0' in inputs_info + assert 'param_imag:0' in inputs_info + param_real_shape_1 = inputs_info['param_real:0'] + param_imag_shape_1 = inputs_info['param_imag:0'] inputs_data = {} - inputs_data['param_real'] = 4 * rng.random(param_real_shape_1).astype(np.float32) - 2 - inputs_data['param_imag'] = 4 * rng.random(param_imag_shape_1).astype(np.float32) - 2 + inputs_data['param_real:0'] = 4 * rng.random(param_real_shape_1).astype(np.float32) - 2 + inputs_data['param_imag:0'] = 4 * rng.random(param_imag_shape_1).astype(np.float32) - 2 return inputs_data def create_complex_strided_slice_net(self, input_shape, begin_value, end_value, strides_value, begin_mask, end_mask, diff --git a/tests/layer_tests/tensorflow_tests/test_tf_SwitchMerge.py b/tests/layer_tests/tensorflow_tests/test_tf_SwitchMerge.py index 640e4c74b8b..c96fd9a9fc4 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_SwitchMerge.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_SwitchMerge.py @@ -9,11 +9,11 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestSwitchMerge(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info + x_shape = inputs_info['x:0'] inputs_data = {} rng = np.random.default_rng() - inputs_data['x'] = rng.integers(-10, 10, x_shape).astype(self.x_type) + inputs_data['x:0'] = rng.integers(-10, 10, x_shape).astype(self.x_type) return inputs_data def merge_eliminating_several_cond_flows_net(self, x_shape, x_type, cond_value): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_TensorArrayOps.py b/tests/layer_tests/tensorflow_tests/test_tf_TensorArrayOps.py index e495fcc48bb..326b428b8a8 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_TensorArrayOps.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_TensorArrayOps.py @@ -19,13 +19,13 @@ def create_tensor_array(data_shape, data_type): class TestTensorArraySizeV3(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'data' in inputs_info - assert 'indices' in inputs_info - data_shape = inputs_info['data'] + assert 'data:0' in inputs_info + assert 'indices:0' in inputs_info + data_shape = inputs_info['data:0'] inputs_data = {} rng = np.random.default_rng() - inputs_data['data'] = rng.integers(-10, 10, data_shape).astype(self.data_type) - inputs_data['indices'] = rng.permutation(self.size).astype(np.int32) + inputs_data['data:0'] = rng.integers(-10, 10, data_shape).astype(self.data_type) + inputs_data['indices:0'] = rng.permutation(self.size).astype(np.int32) return inputs_data def create_tensor_array_size_v3(self, data_shape, data_type): @@ -60,14 +60,14 @@ class TestTensorArraySizeV3(CommonTFLayerTest): class TestTensorArrayReadV3(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'data' in inputs_info - assert 'indices' in inputs_info - data_shape = inputs_info['data'] + assert 'data:0' in inputs_info + assert 'indices:0' in inputs_info + data_shape = inputs_info['data:0'] inputs_data = {} rng = np.random.default_rng() - inputs_data['data'] = rng.integers(-10, 10, data_shape).astype(self.data_type) - inputs_data['index_to_read'] = rng.integers(0, data_shape[0], []).astype(np.int32) - inputs_data['indices'] = rng.permutation(self.size).astype(np.int32) + inputs_data['data:0'] = rng.integers(-10, 10, data_shape).astype(self.data_type) + inputs_data['index_to_read:0'] = rng.integers(0, data_shape[0], []).astype(np.int32) + inputs_data['indices:0'] = rng.permutation(self.size).astype(np.int32) return inputs_data def create_tensor_array_read_v3(self, data_shape, data_type): @@ -104,17 +104,17 @@ class TestTensorArrayReadV3(CommonTFLayerTest): class TestTensorArrayWriteGatherV3(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'data' in inputs_info - assert 'indices' in inputs_info - assert 'value_to_write' in inputs_info - data_shape = inputs_info['data'] - value_shape = inputs_info['value_to_write'] + assert 'data:0' in inputs_info + assert 'indices:0' in inputs_info + assert 'value_to_write:0' in inputs_info + data_shape = inputs_info['data:0'] + value_shape = inputs_info['value_to_write:0'] inputs_data = {} rng = np.random.default_rng() - inputs_data['data'] = rng.integers(-10, 10, data_shape).astype(self.data_type) - inputs_data['value_to_write'] = rng.integers(-10, 10, value_shape).astype(self.data_type) + inputs_data['data:0'] = rng.integers(-10, 10, data_shape).astype(self.data_type) + inputs_data['value_to_write:0'] = rng.integers(-10, 10, value_shape).astype(self.data_type) indices_data = rng.permutation(self.size).astype(np.int32) - inputs_data['indices'] = np.delete(indices_data, np.where(indices_data == self.index_to_write)) + inputs_data['indices:0'] = np.delete(indices_data, np.where(indices_data == self.index_to_write)) return inputs_data def create_tensor_array_write_v3(self, size, data_shape, data_type, index_to_write, indices_to_gather, @@ -170,13 +170,13 @@ class TestTensorArrayWriteGatherV3(CommonTFLayerTest): class TestTensorArrayConcatV3(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'data' in inputs_info - assert 'indices' in inputs_info - data_shape = inputs_info['data'] + assert 'data:0' in inputs_info + assert 'indices:0' in inputs_info + data_shape = inputs_info['data:0'] inputs_data = {} rng = np.random.default_rng() - inputs_data['data'] = rng.integers(-10, 10, data_shape).astype(self.data_type) - inputs_data['indices'] = rng.permutation(self.size).astype(np.int32) + inputs_data['data:0'] = rng.integers(-10, 10, data_shape).astype(self.data_type) + inputs_data['indices:0'] = rng.permutation(self.size).astype(np.int32) return inputs_data def create_tensor_array_concat_v3(self, data_shape, data_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_TensorListConcatV2.py b/tests/layer_tests/tensorflow_tests/test_tf_TensorListConcatV2.py index 293d745cebd..09305569821 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_TensorListConcatV2.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_TensorListConcatV2.py @@ -10,10 +10,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestTensorListConcatV2(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info + x_shape = inputs_info['x:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) return inputs_data def create_tensor_list_resize(self, input_shape, input_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_TensorListLength.py b/tests/layer_tests/tensorflow_tests/test_tf_TensorListLength.py index 28b8196b7e5..f409312e6d7 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_TensorListLength.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_TensorListLength.py @@ -11,10 +11,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestTensorListLength(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info + x_shape = inputs_info['x:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) return inputs_data def create_tensor_list_length(self, input_shape, input_type): @@ -51,7 +51,7 @@ class TestTensorListLength(CommonTFLayerTest): class TestTensorListLengthEmptyList(CommonTFLayerTest): def _prepare_input(self, inputs_info): inputs_data = {} - inputs_data['tensor_list_size'] = np.array([self.tensor_list_size], dtype=np.int32) + inputs_data['tensor_list_size:0'] = np.array([self.tensor_list_size], dtype=np.int32) return inputs_data def create_tensor_list_length_empty_list(self, tensor_list_size, element_shape): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_TensorListResize.py b/tests/layer_tests/tensorflow_tests/test_tf_TensorListResize.py index 4d0f92c76e4..bb68f74dfdc 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_TensorListResize.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_TensorListResize.py @@ -11,10 +11,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestTensorListResize(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info + x_shape = inputs_info['x:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) return inputs_data def create_tensor_list_resize(self, input_shape, input_type, new_size): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Tile.py b/tests/layer_tests/tensorflow_tests/test_tf_Tile.py index 5e034915868..dbd65f681ad 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Tile.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Tile.py @@ -9,13 +9,13 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestTile(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'input' in inputs_info - assert 'multiples' in inputs_info - input_shape = inputs_info['input'] - multiples_shape = inputs_info['multiples'] + assert 'input:0' in inputs_info + assert 'multiples:0' in inputs_info + input_shape = inputs_info['input:0'] + multiples_shape = inputs_info['multiples:0'] inputs_data = {} - inputs_data['input'] = np.random.randint(-50, 50, input_shape).astype(np.float32) - inputs_data['multiples'] = np.random.randint(1, 4, multiples_shape).astype(np.int32) + inputs_data['input:0'] = np.random.randint(-50, 50, input_shape).astype(np.float32) + inputs_data['multiples:0'] = np.random.randint(1, 4, multiples_shape).astype(np.int32) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_ToBool.py b/tests/layer_tests/tensorflow_tests/test_tf_ToBool.py index 8a32e155c34..aa4369f4e43 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_ToBool.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_ToBool.py @@ -9,10 +9,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestToBool(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info + x_shape = inputs_info['x:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(-10, 10, x_shape).astype(np.float32) + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape).astype(np.float32) return inputs_data diff --git a/tests/layer_tests/tensorflow_tests/test_tf_TopKV2.py b/tests/layer_tests/tensorflow_tests/test_tf_TopKV2.py index 8ff2f3e7c2b..1b615bd2f4d 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_TopKV2.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_TopKV2.py @@ -12,10 +12,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestTopKV2(CommonTFLayerTest): def _prepare_input(self, inputs_info): # generate elements so that the input tensor may contain repeating elements - assert 'input' in inputs_info, "Test error: inputs_info must contain `input`" - x_shape = inputs_info['input'] + assert 'input:0' in inputs_info, "Test error: inputs_info must contain `input`" + x_shape = inputs_info['input:0'] inputs_data = {} - inputs_data['input'] = np.random.randint(-10, 10, x_shape) + inputs_data['input:0'] = np.random.randint(-10, 10, x_shape) return inputs_data def create_topk_v2_net(self, input_shape, input_type, k, sorted, is_first_output, is_second_output): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Transpose.py b/tests/layer_tests/tensorflow_tests/test_tf_Transpose.py index 58805ce8d8d..b4e3bb53cab 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Transpose.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Transpose.py @@ -38,13 +38,13 @@ class TestComplexTranspose(CommonTFLayerTest): def _prepare_input(self, inputs_info): import numpy as np rng = np.random.default_rng() - assert 'param_real' in inputs_info - assert 'param_imag' in inputs_info - param_real_shape_1 = inputs_info['param_real'] - param_imag_shape_1 = inputs_info['param_imag'] + assert 'param_real:0' in inputs_info + assert 'param_imag:0' in inputs_info + param_real_shape_1 = inputs_info['param_real:0'] + param_imag_shape_1 = inputs_info['param_imag:0'] inputs_data = {} - inputs_data['param_real'] = 4 * rng.random(param_real_shape_1).astype(np.float32) - 2 - inputs_data['param_imag'] = 4 * rng.random(param_imag_shape_1).astype(np.float32) - 2 + inputs_data['param_real:0'] = 4 * rng.random(param_real_shape_1).astype(np.float32) - 2 + inputs_data['param_imag:0'] = 4 * rng.random(param_imag_shape_1).astype(np.float32) - 2 return inputs_data def create_complex_transpose_net(self, input_shape, perm_value): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_TruncateDiv.py b/tests/layer_tests/tensorflow_tests/test_tf_TruncateDiv.py index 510fe0e0954..b738b1e5b7a 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_TruncateDiv.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_TruncateDiv.py @@ -11,14 +11,14 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestTruncateDiv(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - assert 'y' in inputs_info - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'x:0' in inputs_info + assert 'y:0' in inputs_info + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} # generate x and y to ensure truncation - inputs_data['x'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) - inputs_data['y'] = np.random.randint(1, 10, y_shape).astype(self.input_type) + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) + inputs_data['y:0'] = np.random.randint(1, 10, y_shape).astype(self.input_type) return inputs_data def create_truncate_div_net(self, input_shape, input_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_TruncateMod.py b/tests/layer_tests/tensorflow_tests/test_tf_TruncateMod.py index 34ec7c3d90c..0f235a9930d 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_TruncateMod.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_TruncateMod.py @@ -9,14 +9,14 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestTruncateMod(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - assert 'y' in inputs_info - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'x:0' in inputs_info + assert 'y:0' in inputs_info + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} # generate x and y to ensure truncation - inputs_data['x'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) - inputs_data['y'] = np.random.randint(1, 10, y_shape).astype(self.input_type) + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) + inputs_data['y:0'] = np.random.randint(1, 10, y_shape).astype(self.input_type) return inputs_data def create_truncate_mod_net(self, input_shape, input_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Unique.py b/tests/layer_tests/tensorflow_tests/test_tf_Unique.py index 965365bfc0c..0d93633db10 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Unique.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Unique.py @@ -9,10 +9,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestUnique(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + x_shape = inputs_info['x:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(-10, 10, x_shape) + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape) return inputs_data def create_unique_net(self, x_shape, data_type, out_idx): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_UniqueWithCounts.py b/tests/layer_tests/tensorflow_tests/test_tf_UniqueWithCounts.py index a0e9d6a5aef..e82155f20cd 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_UniqueWithCounts.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_UniqueWithCounts.py @@ -9,10 +9,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestUnique(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + x_shape = inputs_info['x:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(-10, 10, x_shape) + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape) return inputs_data def create_unique_net(self, x_shape, data_type, out_idx): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Unpack.py b/tests/layer_tests/tensorflow_tests/test_tf_Unpack.py index 47f0bc2f53a..2c31bfa0ab4 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Unpack.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Unpack.py @@ -9,10 +9,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestUnpack(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - x_shape = inputs_info['x'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + x_shape = inputs_info['x:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) + inputs_data['x:0'] = np.random.randint(-10, 10, x_shape).astype(self.input_type) return inputs_data def create_unpack_net(self, input_shape, num, axis, input_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_UnravelIndex.py b/tests/layer_tests/tensorflow_tests/test_tf_UnravelIndex.py index 7d3911406f5..57dfb26fd56 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_UnravelIndex.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_UnravelIndex.py @@ -9,10 +9,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestUnravelIndex(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'indices' in inputs_info - indices_shape = inputs_info['indices'] + assert 'indices:0' in inputs_info + indices_shape = inputs_info['indices:0'] inputs_data = {} - inputs_data['indices'] = np.random.randint(0, self.num_elements, indices_shape).astype(self.input_type) + inputs_data['indices:0'] = np.random.randint(0, self.num_elements, indices_shape).astype(self.input_type) return inputs_data def create_unravel_index_net(self, input_shape, input_type, dims_value): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_UnsortedSegmentSum.py b/tests/layer_tests/tensorflow_tests/test_tf_UnsortedSegmentSum.py index 2efdeb4f587..44b1f4615cd 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_UnsortedSegmentSum.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_UnsortedSegmentSum.py @@ -11,14 +11,14 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestUnsortedSegmentSum(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'data' in inputs_info, "Test error: inputs_info must contain `data`" - assert 'segment_ids' in inputs_info, "Test error: inputs_info must contain `segment_ids`" - data_shape = inputs_info['data'] - segment_ids_shape = inputs_info['segment_ids'] + assert 'data:0' in inputs_info, "Test error: inputs_info must contain `data`" + assert 'segment_ids:0' in inputs_info, "Test error: inputs_info must contain `segment_ids`" + data_shape = inputs_info['data:0'] + segment_ids_shape = inputs_info['segment_ids:0'] inputs_data = {} - inputs_data['data'] = np.random.randint(-50, 50, data_shape).astype(self.data_type) + inputs_data['data:0'] = np.random.randint(-50, 50, data_shape).astype(self.data_type) # segment_ids can have negative values - inputs_data['segment_ids'] = np.random.randint(-self.num_segments_val, self.num_segments_val, segment_ids_shape) + inputs_data['segment_ids:0'] = np.random.randint(-self.num_segments_val, self.num_segments_val, segment_ids_shape) return inputs_data def create_unsorted_segment_sum_net(self, data_shape, segment_ids_shape, num_segments_val, data_type, diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Where.py b/tests/layer_tests/tensorflow_tests/test_tf_Where.py index a49b63b67e5..46d51c4ec23 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Where.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Where.py @@ -9,10 +9,10 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestWhere(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'condition' in inputs_info, "Test error: inputs_info must contain `condition`" - condition_shape = inputs_info['condition'] + assert 'condition:0' in inputs_info, "Test error: inputs_info must contain `condition`" + condition_shape = inputs_info['condition:0'] inputs_data = {} - inputs_data['condition'] = np.random.randint(-2, 2, condition_shape) + inputs_data['condition:0'] = np.random.randint(-2, 2, condition_shape) return inputs_data def create_where_net(self, condition_shape, condition_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_While.py b/tests/layer_tests/tensorflow_tests/test_tf_While.py index 8f4b1d09e89..26a34097b73 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_While.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_While.py @@ -11,13 +11,13 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestWhile(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - assert 'y' in inputs_info, "Test error: inputs_info must contain `y`" - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + assert 'y:0' in inputs_info, "Test error: inputs_info must contain `y`" + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(1, 10, x_shape).astype(np.int32) - inputs_data['y'] = np.random.randint(-50, 50, y_shape).astype(np.int32) + inputs_data['x:0'] = np.random.randint(1, 10, x_shape).astype(np.int32) + inputs_data['y:0'] = np.random.randint(-50, 50, y_shape).astype(np.int32) return inputs_data def create_while_net(self, y_shape, data_type, lower_control_flow): @@ -68,13 +68,13 @@ class TestWhile(CommonTFLayerTest): class TestWhileShapeVariant(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - assert 'y' in inputs_info, "Test error: inputs_info must contain `y`" - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + assert 'y:0' in inputs_info, "Test error: inputs_info must contain `y`" + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(1, 10, x_shape).astype(np.int32) - inputs_data['y'] = np.random.randint(-50, 50, y_shape).astype(np.float32) + inputs_data['x:0'] = np.random.randint(1, 10, x_shape).astype(np.int32) + inputs_data['y:0'] = np.random.randint(-50, 50, y_shape).astype(np.float32) return inputs_data def create_while_net(self, y_shape, lower_control_flow): @@ -128,13 +128,13 @@ class TestWhileShapeVariant(CommonTFLayerTest): class TestWhileWithNestedIf(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info, "Test error: inputs_info must contain `x`" - assert 'y' in inputs_info, "Test error: inputs_info must contain `y`" - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" + assert 'y:0' in inputs_info, "Test error: inputs_info must contain `y`" + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} - inputs_data['x'] = np.random.randint(1, 10, x_shape).astype(np.int32) - inputs_data['y'] = np.random.randint(-50, 50, y_shape).astype(np.int32) + inputs_data['x:0'] = np.random.randint(1, 10, x_shape).astype(np.int32) + inputs_data['y:0'] = np.random.randint(-50, 50, y_shape).astype(np.int32) return inputs_data def create_while_with_nested_if_net(self, y_shape, data_type, lower_control_flow): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Xlog1py.py b/tests/layer_tests/tensorflow_tests/test_tf_Xlog1py.py index 63906dd33fa..c3abd66661d 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Xlog1py.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Xlog1py.py @@ -11,16 +11,16 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestXlog1py(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - assert 'y' in inputs_info - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'x:0' in inputs_info + assert 'y:0' in inputs_info + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} # x = [-3 ,3] y = [1, 2] # generate x in way to have zeros - inputs_data['x'] = (6 * np.random.random(size=x_shape).astype(np.float32) - 3) * \ + inputs_data['x:0'] = (6 * np.random.random(size=x_shape).astype(np.float32) - 3) * \ np.random.randint(2, size=x_shape).astype(np.float32) - inputs_data['y'] = np.random.random(size=y_shape).astype(np.float32) + 1 + inputs_data['y:0'] = np.random.random(size=y_shape).astype(np.float32) + 1 return inputs_data def create_xlog1py_net(self, input_shape, input_type): diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Xlogy.py b/tests/layer_tests/tensorflow_tests/test_tf_Xlogy.py index 04db4e64dfd..ce2c5926475 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Xlogy.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Xlogy.py @@ -11,16 +11,16 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestXlogy(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'x' in inputs_info - assert 'y' in inputs_info - x_shape = inputs_info['x'] - y_shape = inputs_info['y'] + assert 'x:0' in inputs_info + assert 'y:0' in inputs_info + x_shape = inputs_info['x:0'] + y_shape = inputs_info['y:0'] inputs_data = {} # x = [-3 ,3] y = [1, 2] # generate x in way to have zeros - inputs_data['x'] = (6 * np.random.random(size=x_shape).astype(np.float32) - 3) * \ + inputs_data['x:0'] = (6 * np.random.random(size=x_shape).astype(np.float32) - 3) * \ np.random.randint(2, size=x_shape).astype(np.float32) - inputs_data['y'] = np.random.random(size=y_shape).astype(np.float32) + 1 + inputs_data['y:0'] = np.random.random(size=y_shape).astype(np.float32) + 1 return inputs_data def create_xlogy_net(self, input_shape, input_type): diff --git a/tools/mo/openvino/tools/mo/moc_frontend/extractor.py b/tools/mo/openvino/tools/mo/moc_frontend/extractor.py index ca11d6663dc..e2611a3db2a 100644 --- a/tools/mo/openvino/tools/mo/moc_frontend/extractor.py +++ b/tools/mo/openvino/tools/mo/moc_frontend/extractor.py @@ -291,7 +291,7 @@ def fe_input_user_data_repack( if freeze_placeholder: # in case freezing via freeze_placeholder_with_value option, _input_shapes can miss some frozen places for input_name in freeze_placeholder: - if input_name in _input_names: + if input_name in _input_names or input_name + ":0" in _input_names: continue node = decode_name_with_port( input_model, input_name, framework, IOType.Input diff --git a/tools/mo/openvino/tools/mo/moc_frontend/pipeline.py b/tools/mo/openvino/tools/mo/moc_frontend/pipeline.py index 28728bb0f00..3dcc8cae8d1 100644 --- a/tools/mo/openvino/tools/mo/moc_frontend/pipeline.py +++ b/tools/mo/openvino/tools/mo/moc_frontend/pipeline.py @@ -181,7 +181,7 @@ def moc_pipeline(argv: argparse.Namespace, moc_front_end: FrontEnd): node = None # look for the certain place in user_shapes for node_cur in user_shapes: - if node_cur.get('input_name') == name: + if node_cur.get('input_name') == name or node_cur.get('input_name') == name + ":0": node = node_cur break if node is None: diff --git a/tools/mo/unit_tests/moc_tf_fe/conversion_basic_models_test.py b/tools/mo/unit_tests/moc_tf_fe/conversion_basic_models_test.py index 26ea01b77d6..32b6455e1b6 100644 --- a/tools/mo/unit_tests/moc_tf_fe/conversion_basic_models_test.py +++ b/tools/mo/unit_tests/moc_tf_fe/conversion_basic_models_test.py @@ -50,13 +50,13 @@ class TestMoFreezePlaceholderTFFE(unittest.TestCase): ), ( "in2{f32}->[0.0 0.0 0.0 0.0]", - {"in1": np.array([[1.0, 2.0], [3.0, 4.0]])}, + {"in1:0": np.array([[1.0, 2.0], [3.0, 4.0]])}, np.array([[1.0, 2.0], [3.0, 4.0]]), np.float32, ), ( "in2->[1.0 15.0 15.5 1.0]", - {"in1": np.array([[2.0, 4.0], [12.0, 8.0]])}, + {"in1:0": np.array([[2.0, 4.0], [12.0, 8.0]])}, np.array([[3.0, 19.0], [27.5, 9.0]]), np.float32, ), @@ -82,7 +82,7 @@ class TestMoFreezePlaceholderTFFE(unittest.TestCase): ), ( "in2->[2 5 6 7 3 2]", - {"in1": np.array([[2, 4, 1], [1, 2, 8]])}, + {"in1:0": np.array([[2, 4, 1], [1, 2, 8]])}, np.array([[4, 20, 6], [7, 6, 16]]), np.int32, ), @@ -102,13 +102,13 @@ class TestMoFreezePlaceholderTFFE(unittest.TestCase): ), ( "in2[2,3]->[True,True,False,True,True,False]", - {"in1": np.array([[False, True, True], [False, True, True]], dtype=bool)}, + {"in1:0": np.array([[False, True, True], [False, True, True]], dtype=bool)}, np.array([[False, True, False], [False, True, False]], dtype=bool), bool, ), ( "in2[]->True", - {"in1": np.array([[False, True, True], [False, True, True]], dtype=bool)}, + {"in1:0": np.array([[False, True, True], [False, True, True]], dtype=bool)}, np.array([[False, True, True], [False, True, True]], dtype=bool), bool, ), @@ -129,21 +129,21 @@ class TestMoFreezePlaceholderTFFE(unittest.TestCase): ), ( None, - {"in1": np.array([2.0, 4.0, 6.0], dtype=np.float32), - "in2": np.array([1.0, 3.0, 5.0], dtype=np.float32)}, + {"in1:0": np.array([2.0, 4.0, 6.0], dtype=np.float32), + "in2:0": np.array([1.0, 3.0, 5.0], dtype=np.float32)}, np.array([2, 4, 6], dtype=np.float32), np.float32, - "cond->False", + "cond:0->False", None, True # fill a bug to investigate why compilation of this model is hang on ), # case: input_shape + freeze_placeholder_with_value ( None, - {"in2": np.array([1.0, 3.0, 5.0], dtype=np.float32)}, + {"in2:0": np.array([1.0, 3.0, 5.0], dtype=np.float32)}, np.array([2, 4, 6], dtype=np.float32), np.float32, - "in1->[2.0 4.0 6.0],cond->True", + "in1:0->[2.0 4.0 6.0],cond:0->True", "[3]", False ), @@ -157,15 +157,15 @@ class TestMoFreezePlaceholderTFFE(unittest.TestCase): @generate( *[ ( - "add:0[3],z", - {"add:0": np.array([4, 5, 6], dtype=np.float32), "z": np.array([1, 2, 3], dtype=np.float32)}, + "add:0[3],z:0", + {"add:0": np.array([4, 5, 6], dtype=np.float32), "z:0": np.array([1, 2, 3], dtype=np.float32)}, np.array([4, 10, 18], dtype=np.float32), np.float32, None ), ( - "add:0{i32}[3],z{i32}", - {"add:0": np.array([4, 5, 6], dtype=np.int32), "z": np.array([1, 2, 3], dtype=np.int32)}, + "add:0{i32}[3],z:0{i32}", + {"add:0": np.array([4, 5, 6], dtype=np.int32), "z:0": np.array([1, 2, 3], dtype=np.int32)}, np.array([4, 10, 18], dtype=np.int32), np.int32, None @@ -287,12 +287,12 @@ class TestMoFreezePlaceholderTFFE(unittest.TestCase): @generate( *[ ( - {"x": np.array([1, 2], dtype=np.int32), "y": np.array([4], dtype=np.int32)}, + {"x:0": np.array([1, 2], dtype=np.int32), "y:0": np.array([4], dtype=np.int32)}, np.array([-3, -2], dtype=np.int32), np.int32, ), ( - {"x": np.array([20, 25], dtype=np.int32), "y": np.array([10], dtype=np.int32)}, + {"x:0": np.array([20, 25], dtype=np.int32), "y:0": np.array([10], dtype=np.int32)}, np.array([30, 35], dtype=np.int32), np.int32, ) diff --git a/tools/mo/unit_tests/moc_tf_fe/conversion_with_checkpoint_v1_test.py b/tools/mo/unit_tests/moc_tf_fe/conversion_with_checkpoint_v1_test.py index 4b7a37495cb..bc6f8ee13cc 100644 --- a/tools/mo/unit_tests/moc_tf_fe/conversion_with_checkpoint_v1_test.py +++ b/tools/mo/unit_tests/moc_tf_fe/conversion_with_checkpoint_v1_test.py @@ -37,6 +37,6 @@ class TestBasicConversion(unittest.TestCase): ckpt_file.write(bytes(checkpoint_byte_stream)) ckpt_file.close() basic_check(input_model="model_with_variable_v1.pbtxt", argv_input=None, - input_data={'input1': np.array([[1]], dtype=np.int64)}, + input_data={'input1:0': np.array([[1]], dtype=np.int64)}, expected_dtype=np.int64, expected_value=np.array([[14108583]], dtype=np.int64), use_new_frontend=True, use_legacy_frontend=False, input_checkpoint=ckpt_file.name) diff --git a/tools/mo/unit_tests/moc_tf_fe/conversion_with_layout_test.py b/tools/mo/unit_tests/moc_tf_fe/conversion_with_layout_test.py index 9fc4f0cb1e6..956fab4df87 100644 --- a/tools/mo/unit_tests/moc_tf_fe/conversion_with_layout_test.py +++ b/tools/mo/unit_tests/moc_tf_fe/conversion_with_layout_test.py @@ -48,16 +48,16 @@ class TestConversionWithBatchAndLayout(unittest.TestCase): @generate( *[ ( - "model_fp32.pbtxt", 5, "in1(cn),in2(cn)", - {"in1": PartialShape([2, 5]), "in2": PartialShape([2, 5])}, + "model_fp32.pbtxt", 5, "in1:0(cn),in2:0(cn)", + {"in1:0": PartialShape([2, 5]), "in2:0": PartialShape([2, 5])}, ), ( - "model_fp32.pbtxt", 9, "in1(nc),in2(nc)", - {"in1": PartialShape([9, 2]), "in2": PartialShape([9, 2])}, + "model_fp32.pbtxt", 9, "in1:0(nc),in2:0(nc)", + {"in1:0": PartialShape([9, 2]), "in2:0": PartialShape([9, 2])}, ), ( - "model_fp32.pbtxt", 7, "in1(?c),in2(?c)", - {"in1": PartialShape([2, 2]), "in2": PartialShape([2, 2])}, + "model_fp32.pbtxt", 7, "in1:0(?c),in2:0(?c)", + {"in1:0": PartialShape([2, 2]), "in2:0": PartialShape([2, 2])}, ), ], ) @@ -67,14 +67,14 @@ class TestConversionWithBatchAndLayout(unittest.TestCase): @generate( *[ ( - "model_with_convolution_dynamic_rank.pbtxt", 7, "x(n???),kernel(????)", - {"x": PartialShape([7, Dimension.dynamic(), Dimension.dynamic(), 3]), - "kernel": PartialShape([2, 2, 3, 1])}, + "model_with_convolution_dynamic_rank.pbtxt", 7, "x:0(n???),kernel:0(????)", + {"x:0": PartialShape([7, Dimension.dynamic(), Dimension.dynamic(), 3]), + "kernel:0": PartialShape([2, 2, 3, 1])}, ), ( - "model_with_convolution_dynamic_rank.pbtxt", 3, "x(???n),kernel(??n?)", - {"x": PartialShape([Dimension.dynamic(), Dimension.dynamic(), Dimension.dynamic(), 3]), - "kernel": PartialShape([2, 2, 3, 1])}, + "model_with_convolution_dynamic_rank.pbtxt", 3, "x:0(???n),kernel:0(??n?)", + {"x:0": PartialShape([Dimension.dynamic(), Dimension.dynamic(), Dimension.dynamic(), 3]), + "kernel:0": PartialShape([2, 2, 3, 1])}, ), ], ) diff --git a/tools/ovc/unit_tests/moc_tf_fe/conversion_basic_models_test.py b/tools/ovc/unit_tests/moc_tf_fe/conversion_basic_models_test.py index d1306523b83..78cf452ec17 100644 --- a/tools/ovc/unit_tests/moc_tf_fe/conversion_basic_models_test.py +++ b/tools/ovc/unit_tests/moc_tf_fe/conversion_basic_models_test.py @@ -76,8 +76,8 @@ class TestMoFreezePlaceholderTFFE(unittest.TestCase): # None # ), ( - "x", - {"x": np.array([[-3, 20, 1]], dtype=np.int32)}, + "x:0", + {"x:0": np.array([[-3, 20, 1]], dtype=np.int32)}, np.array([[-2, 22, 4], [1, 25, 7]], dtype=np.int32), np.int32, None @@ -125,12 +125,12 @@ class TestMoFreezePlaceholderTFFE(unittest.TestCase): @generate( *[ ( - {"x": np.array([1, 2], dtype=np.int32), "y": np.array([4], dtype=np.int32)}, + {"x:0": np.array([1, 2], dtype=np.int32), "y:0": np.array([4], dtype=np.int32)}, np.array([-3, -2], dtype=np.int32), np.int32, ), ( - {"x": np.array([20, 25], dtype=np.int32), "y": np.array([10], dtype=np.int32)}, + {"x:0": np.array([20, 25], dtype=np.int32), "y:0": np.array([10], dtype=np.int32)}, np.array([30, 35], dtype=np.int32), np.int32, ) @@ -144,15 +144,15 @@ class TestMoFreezePlaceholderTFFE(unittest.TestCase): # new frontend ( "model_add_with_undefined_constant.pbtxt", - ("x", [2, 3]), - {"x": np.array([[12, 13, 10], [11, 14, 16]], dtype=np.float32)}, + ("x:0", [2, 3]), + {"x:0": np.array([[12, 13, 10], [11, 14, 16]], dtype=np.float32)}, np.array([[12, 13, 10], [11, 14, 16]], dtype=np.float32), np.float32 ), ( "model_mul_with_undefined_constant.pbtxt", - ("x", [2]), - {"x": np.array([11, -12], dtype=np.int32)}, + ("x:0", [2]), + {"x:0": np.array([11, -12], dtype=np.int32)}, np.array([0, 0], dtype=np.int32), np.int32 ), diff --git a/tools/ovc/unit_tests/moc_tf_fe/conversion_with_checkpoint_v1_test.py b/tools/ovc/unit_tests/moc_tf_fe/conversion_with_checkpoint_v1_test.py index db0b7b86715..51bf93ccf33 100644 --- a/tools/ovc/unit_tests/moc_tf_fe/conversion_with_checkpoint_v1_test.py +++ b/tools/ovc/unit_tests/moc_tf_fe/conversion_with_checkpoint_v1_test.py @@ -37,5 +37,5 @@ class TestBasicConversion(unittest.TestCase): ckpt_file.write(bytes(checkpoint_byte_stream)) ckpt_file.close() basic_check(input_model=["model_with_variable_v1.pbtxt", ckpt_file.name], argv_input=None, - input_data={'input1': np.array([[1]], dtype=np.int64)}, + input_data={'input1:0': np.array([[1]], dtype=np.int64)}, expected_dtype=np.int64, expected_value=np.array([[14108583]], dtype=np.int64))