From 8bc8be6e08db324f56e072e5944045b79de83474 Mon Sep 17 00:00:00 2001 From: George Zlobin Date: Wed, 11 Nov 2020 23:00:40 +0300 Subject: [PATCH] Fix name in VPU_PROFILE and rename to camelCase --- .../hw/conv_tiling/reshape_conv_func.hpp | 2 +- .../src/middleend/passes/reshape_conv.cpp | 26 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/inference-engine/src/vpu/graph_transformer/include/vpu/middleend/hw/conv_tiling/reshape_conv_func.hpp b/inference-engine/src/vpu/graph_transformer/include/vpu/middleend/hw/conv_tiling/reshape_conv_func.hpp index dc930366f15c68..b93a08cf092b4f 100644 --- a/inference-engine/src/vpu/graph_transformer/include/vpu/middleend/hw/conv_tiling/reshape_conv_func.hpp +++ b/inference-engine/src/vpu/graph_transformer/include/vpu/middleend/hw/conv_tiling/reshape_conv_func.hpp @@ -4,6 +4,6 @@ // Function for custom reshape condition for conv 1x1 -int ChoiceDimH(std::string Name, int InC, int OutC, int DimH, int DimW) { +int choiceDimH(std::string name, int inC, int outC, int dimH, int dimW) { return 0; } diff --git a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/reshape_conv.cpp b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/reshape_conv.cpp index 3bf9a01f08f68a..4db3e1d2d76b0b 100644 --- a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/reshape_conv.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/reshape_conv.cpp @@ -23,7 +23,8 @@ class PassImpl final : public Pass { }; void PassImpl::run(const Model& model) { - VPU_PROFILE(hwConvTiling); + VPU_PROFILE(reshapeBeforeConvTiling); + for (const auto& stage : model->getStages()) { if (stage->type() != StageType::StubConv) { continue; @@ -54,8 +55,10 @@ void PassImpl::run(const Model& model) { int outputC = outputDesc.dim(Dim::C); int dimH = inputDesc.dim(Dim::H); int dimW = inputDesc.dim(Dim::W); - int resultW = 0, resultH = 0; - resultH = ChoiceDimH(name, inputC, outputC, dimH, dimW); + int resultH = 0; + int resultW = 0; + + resultH = choiceDimH(name, inputC, outputC, dimH, dimW); if (stage->origLayer()->params.count("ConvReshape")) { std::string rtParam = stage->origLayer()->params.at("ConvReshape"); @@ -70,21 +73,22 @@ void PassImpl::run(const Model& model) { if (resultH == 0) { continue; } + resultW = dimH * dimW / resultH; - auto newDesc_input = inputDesc; - newDesc_input.setDim(Dim::W, resultW); - newDesc_input.setDim(Dim::H, resultH); + auto inputNewDesc = inputDesc; + inputNewDesc.setDim(Dim::W, resultW); + inputNewDesc.setDim(Dim::H, resultH); - auto newDesc_output = outputDesc; - newDesc_output.setDim(Dim::W, resultW); - newDesc_output.setDim(Dim::H, resultH); + auto outputNewDesc = outputDesc; + outputNewDesc.setDim(Dim::W, resultW); + outputNewDesc.setDim(Dim::H, resultH); auto newInput = model->duplicateData(input, "@input-data-after-reshape", - newDesc_input); + inputNewDesc); auto newOutput = model->duplicateData(output, "@output-data-before-reshape", - newDesc_output); + outputNewDesc); model->replaceStageInput(stage->inputEdge(0), newInput); model->replaceStageOutput(stage->outputEdge(0), newOutput);