CMSIS-NN: Added optimized version of arm_avgpool_s8

pull/19/head
Christophe Favergeon 6 years ago
parent bfee0b9c02
commit a435c758dc

@ -20,6 +20,8 @@ static const int REF8_S8_ID=15;
// Output IDs // Output IDs
static const int OUTPUT_S8_ID=0; static const int OUTPUT_S8_ID=0;
static const int TEMP_S8_ID=1;
static const int TEMPINPUT_S8_ID=2;
// Test IDs // Test IDs
static const int TEST_AVGPOOL_S8_1=1; static const int TEST_AVGPOOL_S8_1=1;

@ -44,8 +44,10 @@ __ALIGNED(8) const char testDesc[]={
129,15,0,0, 129,15,0,0,
224,19,0,0, 224,19,0,0,
1,0,0,0, 1,0,0,0,
1,0,0,0, 3,0,0,0,
'O','u','t','p','u','t','\0', 'O','u','t','p','u','t','\0',
'T','e','m','p','\0',
'T','e','m','p','I','n','p','u','t','\0',
0,0,0,0, 0,0,0,0,
1,0,0,0, 1,0,0,0,
1,0,0,0, 1,0,0,0,

@ -11,7 +11,9 @@ class Pooling:public Client::Suite
Client::Pattern<q7_t> input; Client::Pattern<q7_t> input;
Client::LocalPattern<q7_t> tmpInput;
Client::LocalPattern<q7_t> output; Client::LocalPattern<q7_t> output;
Client::LocalPattern<q15_t> temp;
// Reference patterns are not loaded when we are in dump mode // Reference patterns are not loaded when we are in dump mode
Client::RefPattern<q7_t> ref; Client::RefPattern<q7_t> ref;

@ -9,7 +9,11 @@
void Pooling::test_avgpool_s8() void Pooling::test_avgpool_s8()
{ {
const q7_t *inp = input.ptr(); const q7_t *inp = input.ptr();
q7_t *tmpin = tmpInput.ptr();
q7_t *outp = output.ptr(); q7_t *outp = output.ptr();
q15_t *tempp = temp.ptr();
memcpy(tmpin,inp,input.nbSamples());
arm_avgpool_s8( arm_avgpool_s8(
DIM_IN_Y, DIM_IN_Y,
@ -25,7 +29,8 @@
ACT_MIN, ACT_MIN,
ACT_MAX, ACT_MAX,
IN_CHANNEL, IN_CHANNEL,
inp, tmpin,
tempp,
outp); outp);
ASSERT_EQ(ref,output); ASSERT_EQ(ref,output);
@ -194,8 +199,12 @@
} }
temp.create(this->DIM_OUT_X * this->IN_CHANNEL,Pooling::TEMP_S8_ID,mgr);
output.create(ref.nbSamples(),Pooling::OUTPUT_S8_ID,mgr);
output.create(ref.nbSamples(),Pooling::OUTPUT_S8_ID,mgr);
tmpInput.create(input.nbSamples(),Pooling::TEMPINPUT_S8_ID,mgr);
} }

@ -27,8 +27,10 @@ Input7.txt
Ref7.txt Ref7.txt
Input8.txt Input8.txt
Ref8.txt Ref8.txt
1 3
Output Output
Temp
TempInput
0 0
1 1 1 1
n n

@ -627,6 +627,8 @@ group Root {
Pattern REF8_S8_ID : Ref8.txt Pattern REF8_S8_ID : Ref8.txt
Output OUTPUT_S8_ID : Output Output OUTPUT_S8_ID : Output
Output TEMP_S8_ID : Temp
Output TEMPINPUT_S8_ID : TempInput
Functions { Functions {
arm_avgpool_s8 Test 1:test_avgpool_s8 arm_avgpool_s8 Test 1:test_avgpool_s8

Loading…
Cancel
Save