-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IE][VPU]: Enables Extract Dynamic Batch Transformation #3715
Merged
ggladilov
merged 9 commits into
openvinotoolkit:master
from
ggladilov:vpu/gg/extract-dynamic-batch
Jan 13, 2021
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
111bc75
[IE][nGraph]: Enables begin/end iterators for PartialShape
ggladilo 19de805
[IE][VPU][nGraph]: Introduces tree utilities
ggladilo 28d88f2
[IE][VPU][nGraph]: Fixes printTo for nGraph type
ggladilo 32341ae
[IE][VPU]: Introduces SliceConfiguration class
ggladilo 257cc05
[IE][VPU][nGraph]: Enables MatMul operation slice
ggladilo 46f3d94
[IE][VPU][nGraph]: Enables Convolution operations slice
ggladilo c2eb8b1
[IE][VPU][nGraph]: Enables unary eltwise slice
ggladilo 834b1bd
[IE][VPU][nGraph]: Enables binary eltwise slice
ggladilo 1ec01d5
[IE][VPU][nGraph]: Enables extract dynamic batch transformation
ggladilo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...clude/vpu/ngraph/transformations/extract_dynamic_batch/batch_extraction_configuration.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (C) 2020 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <vector> | ||
|
||
namespace vpu { | ||
|
||
enum class SliceMode { | ||
Slice, | ||
Unchanged | ||
}; | ||
|
||
class SliceConfiguration { | ||
public: | ||
SliceConfiguration() = default; | ||
SliceConfiguration(std::vector<SliceMode> inputs, std::vector<SliceMode> outputs); | ||
|
||
bool isSliceSupported() const; | ||
const std::vector<SliceMode>& inputs() const; | ||
const std::vector<SliceMode>& outputs() const; | ||
|
||
private: | ||
bool m_isSliceSupported = false; | ||
std::vector<SliceMode> m_inputs; | ||
std::vector<SliceMode> m_outputs; | ||
}; | ||
|
||
} // namespace vpu |
24 changes: 24 additions & 0 deletions
24
...common/include/vpu/ngraph/transformations/extract_dynamic_batch/extract_dynamic_batch.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (C) 2020 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "ngraph/pass/graph_rewrite.hpp" | ||
|
||
#include <memory> | ||
|
||
namespace vpu { | ||
|
||
class ExtractBatch: public ngraph::pass::FunctionPass { | ||
public: | ||
NGRAPH_RTTI_DECLARATION; | ||
|
||
explicit ExtractBatch(std::unordered_set<ngraph::Node::type_info_t> targets); | ||
bool run_on_function(std::shared_ptr<ngraph::Function> function) override; | ||
|
||
private: | ||
std::unordered_set<ngraph::Node::type_info_t> targets; | ||
}; | ||
|
||
} // namespace vpu |
14 changes: 14 additions & 0 deletions
14
.../common/include/vpu/ngraph/transformations/extract_dynamic_batch/slice_binary_eltwise.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (C) 2020 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "ngraph/ngraph.hpp" | ||
#include "batch_extraction_configuration.hpp" | ||
|
||
namespace vpu { | ||
|
||
SliceConfiguration sliceBinaryEltwise(const ngraph::Node& node); | ||
|
||
} // namespace vpu |
14 changes: 14 additions & 0 deletions
14
...vpu/common/include/vpu/ngraph/transformations/extract_dynamic_batch/slice_convolution.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (C) 2020 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "ngraph/ngraph.hpp" | ||
#include "batch_extraction_configuration.hpp" | ||
|
||
namespace vpu { | ||
|
||
SliceConfiguration sliceConvolution(const ngraph::Node& node); | ||
|
||
} // namespace vpu |
14 changes: 14 additions & 0 deletions
14
...src/vpu/common/include/vpu/ngraph/transformations/extract_dynamic_batch/slice_mat_mul.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (C) 2020 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "ngraph/ngraph.hpp" | ||
#include "batch_extraction_configuration.hpp" | ||
|
||
namespace vpu { | ||
|
||
SliceConfiguration sliceMatMul(const ngraph::Node& node); | ||
|
||
} // namespace vpu |
14 changes: 14 additions & 0 deletions
14
...u/common/include/vpu/ngraph/transformations/extract_dynamic_batch/slice_unary_eltwise.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (C) 2020 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "ngraph/ngraph.hpp" | ||
#include "batch_extraction_configuration.hpp" | ||
|
||
namespace vpu { | ||
|
||
SliceConfiguration sliceUnaryEltwise(const ngraph::Node& node); | ||
|
||
} // namespace vpu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ommon/src/ngraph/transformations/extract_dynamic_batch/batch_extraction_configuration.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (C) 2020 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "vpu/utils/error.hpp" | ||
#include "vpu/ngraph/transformations/extract_dynamic_batch/batch_extraction_configuration.hpp" | ||
|
||
namespace vpu { | ||
|
||
SliceConfiguration::SliceConfiguration(std::vector<SliceMode> inputs, std::vector<SliceMode> outputs) | ||
: m_isSliceSupported(true) | ||
, m_inputs(std::move(inputs)) | ||
, m_outputs(std::move(outputs)) {} | ||
|
||
bool SliceConfiguration::isSliceSupported() const { | ||
return m_isSliceSupported; | ||
} | ||
|
||
const std::vector<SliceMode>& SliceConfiguration::inputs() const { | ||
VPU_THROW_UNLESS(m_isSliceSupported, "Encountered an attempt to access inputs slice configuration for a case when slice is unsupported"); | ||
return m_inputs; | ||
} | ||
|
||
const std::vector<SliceMode>& SliceConfiguration::outputs() const { | ||
VPU_THROW_UNLESS(m_isSliceSupported, "Encountered an attempt to access outputs slice configuration for a case when slice is unsupported"); | ||
return m_outputs; | ||
} | ||
|
||
} // namespace vpu | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still not sure why I had to make this change, but otherwise compiler picks up wrong
printTo
definition and prints empty string forngraph::NodeTypeInfo
- defaultprintTo
implementation