Browse Source

fix lrn within channel, second try

tags/20171017
nihui 8 years ago
parent
commit
ecc5fe345a
3 changed files with 11 additions and 8 deletions
  1. +3
    -2
      src/layer/arm/lrn_arm.cpp
  2. +6
    -4
      src/layer/lrn.cpp
  3. +2
    -2
      src/layer/pooling.cpp

+ 3
- 2
src/layer/arm/lrn_arm.cpp View File

@@ -200,12 +200,14 @@ int LRN_arm::forward_inplace(Mat& bottom_top_blob) const
for (int q=0; q<channels; q++)
{
float* ptr = bottom_top_blob.channel(q);
const float* sptr = square_blob_bordered.channel(q);
const Mat m = square_blob_bordered.channel(q);

for (int i = 0; i < outh; i++)
{
for (int j = 0; j < outw; j++)
{
const float* sptr = m.row(i) + j;

float ss = 0.f;

for (int k = 0; k < maxk; k++)
@@ -218,7 +220,6 @@ int LRN_arm::forward_inplace(Mat& bottom_top_blob) const
}

ptr += outw;
sptr += w;
}
}
}


+ 6
- 4
src/layer/lrn.cpp View File

@@ -174,13 +174,15 @@ int LRN::forward(const Mat& bottom_blob, Mat& top_blob) const
for (int q=0; q<channels; q++)
{
const float* ptr = bottom_blob.channel(q);
const float* sptr = square_blob_bordered.channel(q);
const Mat m = square_blob_bordered.channel(q);
float* outptr = top_blob.channel(q);

for (int i = 0; i < outh; i++)
{
for (int j = 0; j < outw; j++)
{
const float* sptr = m.row(i) + j;

float ss = 0.f;

for (int k = 0; k < maxk; k++)
@@ -193,7 +195,6 @@ int LRN::forward(const Mat& bottom_blob, Mat& top_blob) const
}

ptr += outw;
sptr += w;
outptr += outw;
}
}
@@ -305,12 +306,14 @@ int LRN::forward_inplace(Mat& bottom_top_blob) const
for (int q=0; q<channels; q++)
{
float* ptr = bottom_top_blob.channel(q);
const float* sptr = square_blob_bordered.channel(q);
const Mat m = square_blob_bordered.channel(q);

for (int i = 0; i < outh; i++)
{
for (int j = 0; j < outw; j++)
{
const float* sptr = m.row(i) + j;

float ss = 0.f;

for (int k = 0; k < maxk; k++)
@@ -323,7 +326,6 @@ int LRN::forward_inplace(Mat& bottom_top_blob) const
}

ptr += outw;
sptr += w;
}
}
}


+ 2
- 2
src/layer/pooling.cpp View File

@@ -229,7 +229,7 @@ int Pooling::forward(const Mat& bottom_blob, Mat& top_blob) const
#pragma omp parallel for
for (int q=0; q<channels; q++)
{
const Mat m(w, h, bottom_blob_bordered.channel(q));
const Mat m = bottom_blob_bordered.channel(q);
float* outptr = top_blob.channel(q);

for (int i = 0; i < outh; i++)
@@ -258,7 +258,7 @@ int Pooling::forward(const Mat& bottom_blob, Mat& top_blob) const
#pragma omp parallel for
for (int q=0; q<channels; q++)
{
const Mat m(w, h, bottom_blob_bordered.channel(q));
const Mat m = bottom_blob_bordered.channel(q);
float* outptr = top_blob.channel(q);

for (int i = 0; i < outh; i++)


Loading…
Cancel
Save