mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 11:10:21 +08:00
Merge pull request #16413 from l-bat:ngraph_deconv
This commit is contained in:
commit
f8f74fc4ae
@ -1325,19 +1325,6 @@ public:
|
|||||||
const int group = numOutput / outGroupCn;
|
const int group = numOutput / outGroupCn;
|
||||||
|
|
||||||
if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) {
|
if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) {
|
||||||
if (padMode.empty()) {
|
|
||||||
for (int i = 0; i < adjust_pads.size(); i++) {
|
|
||||||
if (pads_end[i] < adjust_pads[i])
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (padMode == "SAME") {
|
|
||||||
for (int i = 0; i < adjust_pads.size(); i++) {
|
|
||||||
if (kernel_size[i] < pads_begin[i] + 1 + adjust_pads[i])
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (padMode == "VALID")
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return group == 1;
|
return group == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2042,20 +2029,16 @@ public:
|
|||||||
ieWeights = std::make_shared<ngraph::op::Constant>(ngraph::element::f32, kernel_shape, newWeights.data);
|
ieWeights = std::make_shared<ngraph::op::Constant>(ngraph::element::f32, kernel_shape, newWeights.data);
|
||||||
}
|
}
|
||||||
std::vector<size_t> paddings_end;
|
std::vector<size_t> paddings_end;
|
||||||
if (padMode.empty())
|
if (padMode == "SAME")
|
||||||
{
|
|
||||||
for (int i = 0; i < pads_end.size(); i++) {
|
|
||||||
paddings_end.push_back(pads_end[i] - adjust_pads[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (padMode == "SAME")
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < pads_begin.size(); i++) {
|
for (int i = 0; i < pads_begin.size(); i++) {
|
||||||
paddings_end.push_back(kernel_size[i] - pads_begin[i] - 1 - adjust_pads[i]);
|
paddings_end.push_back(kernel_size[i] - pads_begin[i] - 1 - adjust_pads[i]);
|
||||||
}
|
}
|
||||||
|
adjust_pads = std::vector<size_t>(pads_begin.size(), 0);
|
||||||
} else {
|
} else {
|
||||||
paddings_end = pads_end;
|
paddings_end = pads_end;
|
||||||
}
|
}
|
||||||
|
ngraph::op::PadType pad_type = padMode == "VALID" ? ngraph::op::PadType::VALID : ngraph::op::PadType::EXPLICIT;
|
||||||
|
|
||||||
auto deconv = std::make_shared<ngraph::op::v1::ConvolutionBackpropData>(
|
auto deconv = std::make_shared<ngraph::op::v1::ConvolutionBackpropData>(
|
||||||
ieInpNode,
|
ieInpNode,
|
||||||
@ -2063,7 +2046,10 @@ public:
|
|||||||
ngraph::Strides(strides),
|
ngraph::Strides(strides),
|
||||||
ngraph::CoordinateDiff(std::vector<std::ptrdiff_t>(pads_begin.begin(), pads_begin.end())),
|
ngraph::CoordinateDiff(std::vector<std::ptrdiff_t>(pads_begin.begin(), pads_begin.end())),
|
||||||
ngraph::CoordinateDiff(std::vector<std::ptrdiff_t>(paddings_end.begin(), paddings_end.end())),
|
ngraph::CoordinateDiff(std::vector<std::ptrdiff_t>(paddings_end.begin(), paddings_end.end())),
|
||||||
ngraph::Strides(dilations));
|
ngraph::Strides(dilations),
|
||||||
|
pad_type,
|
||||||
|
ngraph::CoordinateDiff(std::vector<std::ptrdiff_t>(adjust_pads.begin(), adjust_pads.end())));
|
||||||
|
|
||||||
if (hasBias() || fusedBias)
|
if (hasBias() || fusedBias)
|
||||||
{
|
{
|
||||||
std::vector<size_t> shape(deconv->get_shape().size(), 1);
|
std::vector<size_t> shape(deconv->get_shape().size(), 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user