mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 14:36:36 +08:00
Clone convolution layer weights only for fusion
This commit is contained in:
parent
d998e70a25
commit
ac262f5b5d
@ -278,7 +278,7 @@ public:
|
|||||||
const int outCn = blobs[0].size[0];
|
const int outCn = blobs[0].size[0];
|
||||||
// prepare weightsMat where each row is aligned and has enough zero padding on the right to
|
// prepare weightsMat where each row is aligned and has enough zero padding on the right to
|
||||||
// use vectorized (i.e. with intrinsics) loops without tail processing
|
// use vectorized (i.e. with intrinsics) loops without tail processing
|
||||||
Mat wm = blobs[0].reshape(1, outCn).clone();
|
Mat wm = blobs[0].reshape(1, outCn);
|
||||||
if( wm.step1() % VEC_ALIGN != 0 )
|
if( wm.step1() % VEC_ALIGN != 0 )
|
||||||
{
|
{
|
||||||
int newcols = (int)alignSize(wm.step1(), VEC_ALIGN);
|
int newcols = (int)alignSize(wm.step1(), VEC_ALIGN);
|
||||||
@ -371,6 +371,10 @@ public:
|
|||||||
|
|
||||||
if (!w.empty())
|
if (!w.empty())
|
||||||
{
|
{
|
||||||
|
// Keep origin weights unchanged.
|
||||||
|
if (weightsMat.data == blobs[0].data)
|
||||||
|
weightsMat = weightsMat.clone();
|
||||||
|
|
||||||
Mat originWeights = blobs[0].reshape(1, outCn);
|
Mat originWeights = blobs[0].reshape(1, outCn);
|
||||||
for (int i = 0; i < outCn; ++i)
|
for (int i = 0; i < outCn; ++i)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user