Skip to content
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

[GNA] Depth-wise separable convolution support #7281

Merged
merged 4 commits into from
Sep 16, 2021

Conversation

sirzabek
Copy link
Contributor

Details:

  • add support for 1D depth-wise separable convolutions
  • refactor code a bit and align transformation files/functions naming for padding and 2D convolution support.

Tickets:

  • 47308

@sirzabek sirzabek force-pushed the gna_dwsc branch 2 times, most recently from 05e48e2 to 2d6cdaa Compare August 31, 2021 06:06
@sirzabek sirzabek marked this pull request as ready for review September 6, 2021 07:10
@sirzabek sirzabek marked this pull request as draft September 6, 2021 10:25
@sirzabek sirzabek marked this pull request as ready for review September 15, 2021 05:21
Copy link
Contributor

@kbruniec kbruniec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

#include "transformations/convert_dwsc_to_scaleshifts.hpp"
#include "common_test_utils/ngraph_test_utils.hpp"
#include <ngraph/function.hpp>
#include <ngraph/opsets/opset7.hpp>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it ok to use opset7 directelly?
isn't there sth like "opset_newest" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion by ngraph developers was to use opset7, so I believe this is the way to go for now.

Comment on lines +81 to +84
auto bias_size = shape_size(add_const->get_shape());
auto conv_filter_count = conv->get_output_shape(0)[1];
if (bias_size == conv_filter_count)
return add_const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider to make more strict const shape comparison,
i.e.: not only compare total shape size but check that each dimension matches expected one by one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's assumed that bias const is flat and should be broadcasted, but I'll take notice of this suggestion in next PR.

@@ -72,4 +73,29 @@ std::shared_ptr<ngraph::opset7::StridedSlice> FlatCrop(ngraph::Output<ngraph::No
std::vector<int64_t>{1, 0}); // end mask
}

std::shared_ptr<ngraph::Node> VerifyBiasGetConst(std::shared_ptr<ngraph::Node> conv, std::shared_ptr<ngraph::Node> bias) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider not to pass conv.
probaby conv filter count could be derived from bias->input(1)->shape[1].

consider to rename VerifyBiasGetConst() into GetVerifiedConstBiasPerFilter()

consider to rename bias into add (or addToVerify)

Copy link
Contributor Author

@sirzabek sirzabek Sep 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If bias->input(1)->shape[1] is compared instead of conv_filter_count then it will be compared with itself.

@dorloff dorloff merged commit 57b5170 into openvinotoolkit:master Sep 16, 2021
akuporos pushed a commit to akuporos/openvino that referenced this pull request Sep 29, 2021
* [GNA] Add support for DWSC, other fixes and code refactoring.

* [GNA] Change supported layout to NHWC

* [GNA] Detect bias const only on second position, move verification of dwsc to matcher
tadamowicz pushed a commit to tadamowicz/openvino that referenced this pull request Aug 30, 2023
* [GNA] Add support for DWSC, other fixes and code refactoring.

* [GNA] Change supported layout to NHWC

* [GNA] Detect bias const only on second position, move verification of dwsc to matcher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants