From: Maksim Doronin Date: Tue, 30 Jun 2020 12:27:22 +0000 (+0300) Subject: [IE VPU] Set name for output DSR in DTS (#1011) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3790b3506091d132e2bbe491755001b0decc84db;p=platform%2Fupstream%2Fdldt.git [IE VPU] Set name for output DSR in DTS (#1011) * [IE VPU] Set name for outDSR in DTS transformations * [IE VPU] Enable NonZero_Transpose tests * [IE VPU] Set name for outDSR in Reduce DTS * [IE VPU] Use move semantic in DTS --- diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_binary_elementwise.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_binary_elementwise.cpp index c4d80fe..f91f9d9 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_binary_elementwise.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_binary_elementwise.cpp @@ -44,7 +44,10 @@ void dynamicToStaticShapeBinaryEltwise(std::shared_ptr eltwise) { } const auto shape = std::make_shared(lhsInput, rhsInput); - ngraph::replace_node(std::move(eltwise), std::make_shared(copied, shape)); + + auto outDSR = std::make_shared(copied, shape); + outDSR->set_friendly_name(eltwise->get_friendly_name()); + ngraph::replace_node(std::move(eltwise), std::move(outDSR)); } } // namespace vpu diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_concat.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_concat.cpp index 05c1279..7f75857 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_concat.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_concat.cpp @@ -107,11 +107,10 @@ void dynamicToStaticShapeConcat(std::shared_ptr target) { } const auto copied = target->clone_with_new_inputs(target->input_values()); - auto outDsr = std::make_shared( - copied, accumulatedShape); - outDsr->set_friendly_name(target->get_friendly_name()); - ngraph::replace_node(std::move(target), outDsr); + auto outDSR = std::make_shared(copied, accumulatedShape); + outDSR->set_friendly_name(target->get_friendly_name()); + ngraph::replace_node(std::move(target), std::move(outDSR)); } } // namespace vpu diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_gather.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_gather.cpp index 54a2f0c..4fb6ed0 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_gather.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_gather.cpp @@ -71,9 +71,10 @@ void dynamicToStaticShapeGather(std::shared_ptr target) { output_dims.push_back(second_data_shape_part); } const auto output_shape = std::make_shared(output_dims, 0); - auto outDsr = std::make_shared(copied, output_shape); - outDsr->set_friendly_name(target->get_friendly_name()); - ngraph::replace_node(target, outDsr); + + auto outDSR = std::make_shared(copied, output_shape); + outDSR->set_friendly_name(target->get_friendly_name()); + ngraph::replace_node(target, std::move(outDSR)); } } // namespace vpu diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_reduce.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_reduce.cpp index 50a60c8..d304e7c 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_reduce.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_reduce.cpp @@ -66,6 +66,9 @@ void dynamicToStaticShapeReduce(std::shared_ptr target) { ngraph::opset3::Constant::create(ngraph::element::i64, {1}, {0})); } const auto copied = target->clone_with_new_inputs(target->input_values()); - ngraph::replace_node(target, std::make_shared(copied, output_shape)); + + auto outDSR = std::make_shared(copied, output_shape); + outDSR->set_friendly_name(target->get_friendly_name()); + ngraph::replace_node(target, std::move(outDSR)); } } // namespace vpu diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_reshape.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_reshape.cpp index 7fedde5..cb144bb 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_reshape.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_reshape.cpp @@ -33,8 +33,9 @@ void dynamicToStaticShapeReshape(std::shared_ptr target) { const auto outShapeOfReshape = std::make_shared( inDataShape, outShapeDescriptor, reshape->get_special_zero()); - ngraph::replace_node(std::move(target), std::make_shared( - copied, outShapeOfReshape)); + auto outDSR = std::make_shared(copied, outShapeOfReshape); + outDSR->set_friendly_name(reshape->get_friendly_name()); + ngraph::replace_node(std::move(target), std::move(outDSR)); } } // namespace vpu diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_roialign.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_roialign.cpp index 9a93ca8..a591c2a 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_roialign.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_roialign.cpp @@ -49,7 +49,10 @@ void dynamicToStaticShapeROIAlign(std::shared_ptr target) { ngraph::OutputVector{num_rois, c, pooled_h, pooled_w}, 0); const auto copied = target->clone_with_new_inputs(target->input_values()); - ngraph::replace_node(target, std::make_shared(copied, output_shape)); + + auto outDSR = std::make_shared(copied, output_shape); + outDSR->set_friendly_name(roi_align->get_friendly_name()); + ngraph::replace_node(target, std::move(outDSR)); } } // namespace vpu diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_squeeze.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_squeeze.cpp index a21e6cd..46f60cc 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_squeeze.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_squeeze.cpp @@ -53,7 +53,10 @@ void dynamicToStaticShapeSqueeze(std::shared_ptr target) { const auto axis = std::make_shared( ngraph::element::i64, ngraph::Shape{1}, std::vector{0}); const auto squeeze_output_shape = std::make_shared(shape, index, axis); - ngraph::replace_node(std::move(target), std::make_shared(copied, squeeze_output_shape)); + + auto outDSR = std::make_shared(copied, squeeze_output_shape); + outDSR->set_friendly_name(squeeze->get_friendly_name()); + ngraph::replace_node(std::move(target), std::move(outDSR)); } } // namespace vpu diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_strided_slice.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_strided_slice.cpp index b442b02..6e7fcd4 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_strided_slice.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_strided_slice.cpp @@ -109,35 +109,39 @@ void dynamicToStaticShapeStridedSlice(std::shared_ptr target) { "DynamicToStaticShape transformation for {} of type {} expects {} as input with index {}", target->get_friendly_name(), target->get_type_info(), ngraph::vpu::op::DynamicShapeResolver::type_info, 0); - const auto ss = ngraph::as_type_ptr(target); - VPU_THROW_UNLESS(ss, "dynamicToStaticShapeStridedSlice transformation is not applicable for {}", target); + const auto stridedSlice = ngraph::as_type_ptr(target); + VPU_THROW_UNLESS(stridedSlice, "dynamicToStaticShapeStridedSlice transformation is not applicable for {}", target); const auto all_zero = [](const std::vector & v) {return std::all_of(v.cbegin(), v.cend(), [](const int64_t & i){return i == 0;});}; - VPU_THROW_UNLESS(all_zero(ss->get_new_axis_mask()), + VPU_THROW_UNLESS(all_zero(stridedSlice->get_new_axis_mask()), "dynamicToStaticShapeStridedSlice transformation is not applicable for {}, new_axis_mask expected to be zeros", target); - VPU_THROW_UNLESS(all_zero(ss->get_shrink_axis_mask()), + VPU_THROW_UNLESS(all_zero(stridedSlice->get_shrink_axis_mask()), "dynamicToStaticShapeStridedSlice transformation is not applicable for {}, shrink_axis_mask expected to be zeros", target); - VPU_THROW_UNLESS(all_zero(ss->get_ellipsis_mask()), + VPU_THROW_UNLESS(all_zero(stridedSlice->get_ellipsis_mask()), "dynamicToStaticShapeStridedSlice transformation is not applicable for {}, ellipsis_mask expected to be zeros", target); - const auto get_i64_vector_from_const = [&ss](std::shared_ptr node_ptr) { + const auto get_i64_vector_from_const = [&stridedSlice](std::shared_ptr node_ptr) { const auto constant = ngraph::as_type_ptr(node_ptr); VPU_THROW_UNLESS(constant, - "dynamicToStaticShapeStridedSlice transformation is not applicable for {}, begin, end and stride inputs are expected to be constants", ss); + "dynamicToStaticShapeStridedSlice transformation is not applicable for {}, begin, end and stride inputs are expected to be constants", + stridedSlice); return constant->cast_vector(); }; const auto input_shape = dsr->input_value(1); const auto output_shape = calculate_output_shape( - get_i64_vector_from_const(ss->input_value(1).get_node_shared_ptr()), - get_i64_vector_from_const(ss->input_value(2).get_node_shared_ptr()), - get_i64_vector_from_const(ss->input_value(3).get_node_shared_ptr()), - convert_mask_to_axis_set(ss->get_begin_mask()), - convert_mask_to_axis_set(ss->get_end_mask()), + get_i64_vector_from_const(stridedSlice->input_value(1).get_node_shared_ptr()), + get_i64_vector_from_const(stridedSlice->input_value(2).get_node_shared_ptr()), + get_i64_vector_from_const(stridedSlice->input_value(3).get_node_shared_ptr()), + convert_mask_to_axis_set(stridedSlice->get_begin_mask()), + convert_mask_to_axis_set(stridedSlice->get_end_mask()), input_shape); - const auto copied = ss->clone_with_new_inputs(target->input_values()); - ngraph::replace_node(std::move(target), std::make_shared(copied, output_shape)); + const auto copied = stridedSlice->clone_with_new_inputs(target->input_values()); + + auto outDSR = std::make_shared(copied, output_shape); + outDSR->set_friendly_name(stridedSlice->get_friendly_name()); + ngraph::replace_node(std::move(target), std::move(outDSR)); } } // namespace vpu diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_topk.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_topk.cpp index 7d69140..93e37dc 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_topk.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_topk.cpp @@ -77,7 +77,10 @@ void dynamicToStaticShapeTopK(std::shared_ptr target) { topk->get_sort_type(), topk->get_index_element_type()); - for (auto &output : target->outputs()) - output.replace(std::make_shared(new_topk->output(output.get_index()), output_shape)); + for (auto &output : target->outputs()) { + const auto outDSR = std::make_shared(new_topk->output(output.get_index()), output_shape); + outDSR->set_friendly_name(topk->get_friendly_name() + "." + std::to_string(output.get_index())); + output.replace(outDSR); + } } } // namespace vpu diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_transpose.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_transpose.cpp index ac1bb3a..f45a441 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_transpose.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_transpose.cpp @@ -34,7 +34,10 @@ void dynamicToStaticShapeTranspose(std::shared_ptr target) { ngraph::Shape{std::initializer_list{1}}, std::vector{0}); const auto scatterElementsUpdate = std::make_shared(shape, transposition, shape, axis); - ngraph::replace_node(std::move(target), std::make_shared(copied, scatterElementsUpdate)); + + auto outDSR = std::make_shared(copied, scatterElementsUpdate); + outDSR->set_friendly_name(transpose->get_friendly_name()); + ngraph::replace_node(std::move(target), std::move(outDSR)); } } // namespace vpu diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_unary_elementwise.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_unary_elementwise.cpp index b921a61..6d51589 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_unary_elementwise.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_unary_elementwise.cpp @@ -22,7 +22,10 @@ void dynamicToStaticUnaryElementwise(std::shared_ptr target) { const auto shape = dsr->input(1).get_source_output(); const auto copied = target->clone_with_new_inputs(target->input_values()); - ngraph::replace_node(target, std::make_shared(copied, shape)); + + auto outDSR = std::make_shared(copied, shape); + outDSR->set_friendly_name(target->get_friendly_name()); + ngraph::replace_node(target, std::move(outDSR)); } } // namespace vpu diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_unsqueeze.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_unsqueeze.cpp index 0dde63d..81c053b 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_unsqueeze.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_unsqueeze.cpp @@ -58,7 +58,10 @@ void dynamicToStaticShapeUnsqueeze(std::shared_ptr target) { new_shape_dims.insert(new_shape_dims.begin() + i, new_dim); } const auto unsqueeze_output_shape = std::make_shared(new_shape_dims, 0); - ngraph::replace_node(std::move(target), std::make_shared(copied, unsqueeze_output_shape)); + + auto outDSR = std::make_shared(copied, unsqueeze_output_shape); + outDSR->set_friendly_name(unsqueeze->get_friendly_name()); + ngraph::replace_node(std::move(target), std::move(outDSR)); } } // namespace vpu diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_variadic_split.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_variadic_split.cpp index 9828c00..c0e4553 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_variadic_split.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_variadic_split.cpp @@ -62,15 +62,18 @@ void dynamicToStaticShapeVariadicSplit(std::shared_ptr target) { } for (auto i = 0; i < split_lengths.size(); ++i) { const auto dim = ngraph::opset3::Constant::create(data_shape->get_element_type(), {1}, {split_lengths[i]}); + auto dsrShapeInput = dim->shared_from_this(); + if (!first_shape_part.empty() || !second_shape_part.empty()) { ngraph::OutputVector output_dims{dim}; output_dims.insert(output_dims.begin(), first_shape_part.begin(), first_shape_part.end()); output_dims.insert(output_dims.end(), second_shape_part.begin(), second_shape_part.end()); - const auto output_shape = std::make_shared(output_dims, 0); - target->output(i).replace(std::make_shared(copied->output(i), output_shape)); - } else { - target->output(i).replace(std::make_shared(copied->output(i), dim)); + dsrShapeInput = std::make_shared(output_dims, 0); } + + const auto outDSR = std::make_shared(copied->output(i), dsrShapeInput); + outDSR->set_friendly_name(target->get_friendly_name() + "." + std::to_string(target->output(0).get_index())); + target->output(i).replace(outDSR); } } diff --git a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/skip_tests_config.cpp b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/skip_tests_config.cpp index 339322b..f143f55 100644 --- a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/skip_tests_config.cpp +++ b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/skip_tests_config.cpp @@ -18,9 +18,5 @@ std::vector disabledTestPatterns() { ".*Behavior.*ExecGraphTests.*", // TODO: Issue: 26268 ".*ConcatLayerTest.*axis=0.*", -#if defined(_WIN32) || defined(_WIN64) - //TODO: Issue: 33722 - ".*DynamicTranspose.*NonZero_Transpose.*", -#endif }; }