mirror of
https://github.com/opencv/opencv.git
synced 2025-07-31 18:07:08 +08:00
Fix weights fusion for Convolution and Deconvolution layers in nGraph
This commit is contained in:
parent
a011035ed6
commit
c2ca3ee2fa
@ -553,10 +553,10 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mat newWeights = blobs[0].reshape(1, outCn);
|
Mat newWeights;
|
||||||
Mat cvWeights = weightsMat.colRange(0, newWeights.cols);
|
Mat cvWeights = weightsMat.colRange(0, blobs[0].total() / outCn);
|
||||||
cvWeights.copyTo(newWeights);
|
cvWeights.copyTo(newWeights);
|
||||||
ieWeights = std::make_shared<ngraph::op::Constant>(ngraph::element::f32, kernel_shape, blobs[0].data);
|
ieWeights = std::make_shared<ngraph::op::Constant>(ngraph::element::f32, kernel_shape, newWeights.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2033,9 +2033,9 @@ public:
|
|||||||
|
|
||||||
if (fusedWeights)
|
if (fusedWeights)
|
||||||
{
|
{
|
||||||
int inpCn = blobs[0].size[0];
|
Mat newWeights;
|
||||||
Mat newWeights = blobs[0].reshape(1, inpCn);
|
|
||||||
transpose(weightsMat, newWeights);
|
transpose(weightsMat, newWeights);
|
||||||
|
ieWeights = std::make_shared<ngraph::op::Constant>(ngraph::element::f32, kernel_shape, newWeights.data);
|
||||||
}
|
}
|
||||||
size_t batch = ieInpNode->get_shape()[0];
|
size_t batch = ieInpNode->get_shape()[0];
|
||||||
std::vector<size_t> out_shape = {batch, (size_t)numOutput};
|
std::vector<size_t> out_shape = {batch, (size_t)numOutput};
|
||||||
|
Loading…
Reference in New Issue
Block a user