未验证 提交 f7c7c98a 编写于 作者: Q quinlan-w 提交者: GitHub

fix pad bug, which could drop accuracy (#1341)

Co-authored-by: NZhiquan Wang <wangzhiquan@axera-tech.com>
上级 7e20bfc6
...@@ -73,21 +73,11 @@ static void ref_pad_fp32(float* input, float* output, int in_h, int in_w, int ou ...@@ -73,21 +73,11 @@ static void ref_pad_fp32(float* input, float* output, int in_h, int in_w, int ou
{ {
outptr[x] = v; outptr[x] = v;
} }
if (in_w < 12) for (x = 0; x < in_w; x++)
{ {
for (; x < (left + in_w); x++) outptr[left + x] = ptr[x];
{
outptr[x] = ptr[x - left];
}
} }
else for (x = out_w - left; x < out_w; x++)
{
for (x = 0; x < in_w; x++)
{
outptr[left + x] = ptr[x];
}
}
for (; x < out_w; x++)
{ {
outptr[x] = v; outptr[x] = v;
} }
...@@ -331,21 +321,11 @@ static void ref_pad_uint8(uint8_t* input, uint8_t* output, int in_h, int in_w, i ...@@ -331,21 +321,11 @@ static void ref_pad_uint8(uint8_t* input, uint8_t* output, int in_h, int in_w, i
{ {
outptr[x] = v; outptr[x] = v;
} }
if (in_w < 12) for (x = 0; x < in_w; x++)
{ {
for (; x < (left + in_w); x++) outptr[left + x] = ptr[x];
{
outptr[x] = ptr[x - left];
}
} }
else for (x = out_w - left; x < out_w; x++)
{
for (x = 0; x < in_w; x++)
{
outptr[left + x] = ptr[x];
}
}
for (; x < out_w; x++)
{ {
outptr[x] = v; outptr[x] = v;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册