Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/layer/arm/shufflechannel_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int ShuffleChannel_arm::forward(const Mat& bottom_blob, Mat& top_blob, const Opt

ptr1 += 2;

for (int i = 0; i < size; i++)
for (int i = 0; i < size - 1; i++)
{
float32x4_t _p0 = vld1q_f32(ptr0);
float32x4_t _p1 = vld1q_f32(ptr1);
Expand All @@ -119,6 +119,16 @@ int ShuffleChannel_arm::forward(const Mat& bottom_blob, Mat& top_blob, const Opt
ptr1 += 4;
outptr0 += 4;
}

{
outptr0[0] = ptr0[0];
outptr0[1] = ptr1[0];
outptr0[2] = ptr0[1];
outptr0[3] = ptr1[1];
ptr0 += 2;
ptr1 += 2;
outptr0 += 4;
}
}

return 0;
Expand Down Expand Up @@ -587,7 +597,7 @@ int ShuffleChannel_arm::forward_bf16s_fp16s(const Mat& bottom_blob, Mat& top_blo

ptr1 += 2;

for (int i = 0; i < size; i++)
for (int i = 0; i < size - 1; i++)
{
uint16x4_t _p0 = vld1_u16(ptr0);
uint16x4_t _p1 = vld1_u16(ptr1);
Expand All @@ -600,6 +610,16 @@ int ShuffleChannel_arm::forward_bf16s_fp16s(const Mat& bottom_blob, Mat& top_blo
ptr1 += 4;
outptr0 += 4;
}

{
outptr0[0] = ptr0[0];
outptr0[1] = ptr1[0];
outptr0[2] = ptr0[1];
outptr0[3] = ptr1[1];
ptr0 += 2;
ptr1 += 2;
outptr0 += 4;
}
}

return 0;
Expand Down
12 changes: 11 additions & 1 deletion src/layer/x86/shufflechannel_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ int ShuffleChannel_x86::forward(const Mat& bottom_blob, Mat& top_blob, const Opt

ptr1 += 2;

for (int i = 0; i < size; i++)
for (int i = 0; i < size - 1; i++)
{
__m128 _p0 = _mm_loadu_ps(ptr0);
__m128 _p1 = _mm_loadu_ps(ptr1);
Expand All @@ -610,6 +610,16 @@ int ShuffleChannel_x86::forward(const Mat& bottom_blob, Mat& top_blob, const Opt
ptr1 += 4;
outptr += 4;
}

{
outptr[0] = ptr0[0];
outptr[1] = ptr1[0];
outptr[2] = ptr0[1];
outptr[3] = ptr1[1];
ptr0 += 2;
ptr1 += 2;
outptr += 4;
}
}

return 0;
Expand Down
2 changes: 2 additions & 0 deletions tests/test_shufflechannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ static int test_shufflechannel_0()
|| test_shufflechannel(5, 7, 16, 2, 0)
|| test_shufflechannel(5, 9, 16, 4, 0)
|| test_shufflechannel(3, 7, 16, 8, 0)
|| test_shufflechannel(1, 1, 20, 2, 0)
|| test_shufflechannel(5, 7, 20, 2, 0)
|| test_shufflechannel(5, 7, 24, 2, 0)
|| test_shufflechannel(3, 7, 24, 3, 0)
Expand All @@ -63,6 +64,7 @@ static int test_shufflechannel_1()
|| test_shufflechannel(5, 7, 16, 2, 1)
|| test_shufflechannel(5, 9, 16, 4, 1)
|| test_shufflechannel(3, 7, 16, 8, 1)
|| test_shufflechannel(1, 1, 20, 10, 1)
|| test_shufflechannel(5, 7, 20, 2, 1)
|| test_shufflechannel(5, 7, 24, 2, 1)
|| test_shufflechannel(3, 7, 24, 3, 1)
Expand Down
Loading