Skip to content

Commit

Permalink
*fix bug: Error in Base implementation of SynetMergedConvolution32f (…
Browse files Browse the repository at this point in the history
…type=CDC, add=1).
  • Loading branch information
ermig1979 committed Dec 7, 2020
1 parent 9d20d80 commit f56db34
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
4 changes: 4 additions & 0 deletions docs/2021.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ <h5>New features</h5>
<li>Base implementation, SSE2, AVX2, AVX-512F and NEON optimizations of function SynetMish32f.</li>
<li>Support of Mish activation function in Convolution32f framework.</li>
</ul>
<h5>Bug fixing</h5>
<ul>
<li>Error in Base implementation of SynetMergedConvolution32f (type=CDC, add=1).</li>
</ul>

<h4>Test framework</h4>
<h5>New features</h5>
Expand Down
12 changes: 10 additions & 2 deletions src/Simd/SimdBaseSynetMergedConvolution32f.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,16 @@ namespace Simd
}
}
}
for (size_t dc = 0; dc < dstC; ++dc)
Update<update>(dst + dc, Activate<type>(buf[dc], params, dc));
if (update == UpdateAdd)
{
for (size_t dc = 0; dc < dstC; ++dc)
dst[dc] = Activate<type>(dst[dc] + buf[dc], params, dc);
}
else
{
for (size_t dc = 0; dc < dstC; ++dc)
dst[dc] = Activate<type>(buf[dc], params, dc);
}
dst += p.dstC;
}
}
Expand Down
17 changes: 9 additions & 8 deletions src/Test/TestSynetMergedConvolution32f.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ namespace Test
{
bool result = true;
const SimdBool t = SimdTrue, f = SimdFalse;
const ::SimdConvolutionActivationType a0 = ::SimdConvolutionActivationHswish, a1 = ::SimdConvolutionActivationIdentity, a2 = ::SimdConvolutionActivationPrelu;
//const ::SimdConvolutionActivationType a0 = ::SimdConvolutionActivationHswish, a1 = ::SimdConvolutionActivationIdentity, a2 = ::SimdConvolutionActivationPrelu;
//const ::SimdConvolutionActivationType a0 = ::SimdConvolutionActivationPrelu, a1 = ::SimdConvolutionActivationRestrictRange, a2 = ::SimdConvolutionActivationHswish;
const ::SimdConvolutionActivationType a0 = ::SimdConvolutionActivationHswish, a1 = ::SimdConvolutionActivationPrelu, a2 = ::SimdConvolutionActivationRelu;
#ifdef NDEBUG
#if 0
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 3, 384, 389), Cnv(a0, 3, 2, 32), Cnv(a1, 3, 1), Cnv(a2, 1, 1, 16), f), f1, f2);
Expand Down Expand Up @@ -238,10 +239,6 @@ namespace Test
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 48, 70, 81), Cnv(a0, 3, 2), Cnv(a1, 1, 1, 64)), f1, f2);
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 3, 320, 320), Cnv(a0, 3, 2, 16), Cnv(a1, 3, 1)), f1, f2);
#endif
#if 0
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 19, 63, 81), Cnv(a0, 1, 1, 51), Cnv(a1, 3, 2)), f1, f2);
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 1280, 12, 21), Cnv(a0, 1, 1, 256), Cnv(a1, 3, 2)), f1, f2);
#endif
#if 0
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 3, 320, 180), Cnv(a0, 3, 2, 16), Cnv(a1, 3, 1)), f1, f2);
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 16, 160, 90), Cnv(a0, 1, 1, 32), Cnv(a1, 3, 2)), f1, f2);
Expand All @@ -266,13 +263,17 @@ namespace Test
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 256, 10, 6), Cnv(a0, 3, 1), Cnv(a1, 1, 1, 4)), f1, f2);
#endif
#if 1
//result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 256, 10, 6), Cnv(a0, 1, 1, 64), Cnv(a1, 3, 2), Cnv(a2, 1, 1, 256), f), f1, f2);
//result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 64, 10, 6), Cnv(a0, 1, 1, 256), Cnv(a1, 3, 1), Cnv(a2, 1, 1, 64), t), f1, f2);
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 19, 63, 81), Cnv(a0, 1, 1, 51), Cnv(a1, 3, 2)), f1, f2);
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 1280, 12, 21), Cnv(a0, 1, 1, 256), Cnv(a1, 3, 2)), f1, f2);
#endif
#if 1
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 64, 10, 6), Cnv(a0, 1, 1, 256), Cnv(a1, 3, 1), Cnv(a2, 1, 1, 64), t), f1, f2);
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 256, 10, 6), Cnv(a0, 1, 1, 64), Cnv(a1, 3, 2), Cnv(a2, 1, 1, 256), f), f1, f2);
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 128, 20, 12), Cnv(a0, 3, 1), Cnv(a1, 1, 1, 20)), f1, f2);
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 128, 20, 12), Cnv(a0, 3, 1), Cnv(a1, 1, 1, 128)), f1, f2);
#endif
#else
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 1280, 12, 21), Cnv(a0, 1, 1, 256), Cnv(a1, 3, 2)), f1, f2);
result = result && SynetMergedConvolution32fForwardAutoTest(eps, Param(Shp(1, 64, 10, 6), Cnv(a0, 1, 1, 256), Cnv(a1, 3, 1), Cnv(a2, 1, 1, 64), t), f1, f2);
#endif
return result;
}
Expand Down

0 comments on commit f56db34

Please sign in to comment.