Skip to content

Commit

Permalink
Fix name in VPU_PROFILE and rename to camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
ZlobinGM committed Nov 11, 2020
1 parent e9701e7 commit 8bc8be6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand All @@ -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);
Expand Down

0 comments on commit 8bc8be6

Please sign in to comment.