CMSIS-NN:Added code to be able to benchmark arm_avgpool_s8.
Benchmarking code added into CMSIS-DSP test framework.pull/19/head
parent
a435c758dc
commit
3b5bcc421f
@ -0,0 +1,5 @@
|
||||
CATEGORY,NAME,ID,OLDID,NB,CYCLES,OPTIMIZED,HARDFP,FASTMATH,NEON,UNROLL,ROUNDING,PLATFORM,CORE,COMPILER,VERSION
|
||||
"NN:Pooling","test_avgpool_s8",1,"",10,87558,1,1,1,0,1,0,FVP,ARMCM7_DP,AC6,6120001
|
||||
"NN:Pooling","test_avgpool_s8",1,"",20,177505,1,1,1,0,1,0,FVP,ARMCM7_DP,AC6,6120001
|
||||
"NN:Pooling","test_avgpool_s8",1,"",100,885034,1,1,1,0,1,0,FVP,ARMCM7_DP,AC6,6120001
|
||||
"NN:Pooling","test_avgpool_s8",1,"",200,1772498,1,1,1,0,1,0,FVP,ARMCM7_DP,AC6,6120001
|
||||
|
@ -0,0 +1,2 @@
|
||||
"ID","OLDID","CATEGORY","NAME","OPTIMIZED","HARDFP","FASTMATH","NEON","UNROLL","ROUNDING","PLATFORM","CORE","COMPILER","VERSION","Regression","MAX"
|
||||
1,"","NN:Pooling","test_avgpool_s8",1,1,1,0,1,0,"FVP","ARMCM7_DP","AC6",6120001,"-648.9462943071558 + NB * 8864.214500537057",1772498
|
||||
|
@ -0,0 +1,13 @@
|
||||
void test_avgpool_s8();
|
||||
|
||||
// Pattern IDs
|
||||
static const int INPUT1_S8_ID=0;
|
||||
static const int REF1_S8_ID=1;
|
||||
|
||||
// Output IDs
|
||||
static const int OUTPUT_S8_ID=0;
|
||||
static const int TEMP_S8_ID=1;
|
||||
static const int TEMPINPUT_S8_ID=2;
|
||||
|
||||
// Test IDs
|
||||
static const int TEST_AVGPOOL_S8_1=1;
|
||||
@ -0,0 +1,37 @@
|
||||
#include "Test.h"
|
||||
#include "Pattern.h"
|
||||
class PoolingBench:public Client::Suite
|
||||
{
|
||||
public:
|
||||
PoolingBench(Testing::testID_t id);
|
||||
void setUp(Testing::testID_t,std::vector<Testing::param_t>& paramsArgs,Client::PatternMgr *mgr);
|
||||
void tearDown(Testing::testID_t,Client::PatternMgr *mgr);
|
||||
private:
|
||||
#include "PoolingBench_decl.h"
|
||||
|
||||
Client::Pattern<q7_t> input;
|
||||
|
||||
Client::LocalPattern<q7_t> tmpInput;
|
||||
Client::LocalPattern<q7_t> output;
|
||||
Client::LocalPattern<q15_t> temp;
|
||||
|
||||
// Reference patterns are not loaded when we are in dump mode
|
||||
Client::RefPattern<q7_t> ref;
|
||||
|
||||
int DIM_IN_X;
|
||||
int DIM_IN_Y;
|
||||
int DIM_OUT_X;
|
||||
int DIM_OUT_Y;
|
||||
int IN_CHANNEL;
|
||||
int DIM_FILTER_X;
|
||||
int DIM_FILTER_Y;
|
||||
int PAD_WIDTH;
|
||||
int PAD_HEIGHT;
|
||||
int STRIDE_X;
|
||||
int STRIDE_Y;
|
||||
int ACT_MIN;
|
||||
int ACT_MAX;
|
||||
|
||||
int repeatNb;
|
||||
|
||||
};
|
||||
@ -0,0 +1,85 @@
|
||||
#include "PoolingBench.h"
|
||||
#include "Error.h"
|
||||
#include "arm_nnfunctions.h"
|
||||
#include "Test.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
void PoolingBench::test_avgpool_s8()
|
||||
{
|
||||
q7_t *tmpin = tmpInput.ptr();
|
||||
q7_t *outp = output.ptr();
|
||||
q15_t *tempp = temp.ptr();
|
||||
|
||||
for(int i=0; i < this->repeatNb; i++)
|
||||
{
|
||||
arm_avgpool_s8(
|
||||
DIM_IN_Y,
|
||||
DIM_IN_X,
|
||||
DIM_OUT_Y,
|
||||
DIM_OUT_X,
|
||||
STRIDE_Y,
|
||||
STRIDE_X,
|
||||
DIM_FILTER_Y,
|
||||
DIM_FILTER_X,
|
||||
PAD_HEIGHT,
|
||||
PAD_WIDTH,
|
||||
ACT_MIN,
|
||||
ACT_MAX,
|
||||
IN_CHANNEL,
|
||||
tmpin,
|
||||
tempp,
|
||||
outp);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PoolingBench::setUp(Testing::testID_t id,std::vector<Testing::param_t>& paramsArgs,Client::PatternMgr *mgr)
|
||||
{
|
||||
|
||||
std::vector<Testing::param_t>::iterator it = paramsArgs.begin();
|
||||
this->repeatNb = *it;
|
||||
|
||||
switch(id)
|
||||
{
|
||||
case PoolingBench::TEST_AVGPOOL_S8_1:
|
||||
input.reload(PoolingBench::INPUT1_S8_ID,mgr);
|
||||
ref.reload(PoolingBench::REF1_S8_ID,mgr);
|
||||
|
||||
this->DIM_IN_X= 4;
|
||||
this->DIM_IN_Y= 2;
|
||||
this->DIM_OUT_X= 2;
|
||||
this->DIM_OUT_Y= 1;
|
||||
this->IN_CHANNEL= 101;
|
||||
this->DIM_FILTER_X= 2;
|
||||
this->DIM_FILTER_Y= 2;
|
||||
this->PAD_WIDTH= 0;
|
||||
this->PAD_HEIGHT= 0;
|
||||
this->STRIDE_X= 2;
|
||||
this->STRIDE_Y= 2;
|
||||
this->ACT_MIN= -128;
|
||||
this->ACT_MAX= 127;
|
||||
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
temp.create(this->DIM_OUT_X * this->IN_CHANNEL,PoolingBench::TEMP_S8_ID,mgr);
|
||||
|
||||
output.create(ref.nbSamples(),PoolingBench::OUTPUT_S8_ID,mgr);
|
||||
tmpInput.create(input.nbSamples(),PoolingBench::TEMPINPUT_S8_ID,mgr);
|
||||
|
||||
q7_t *tmpin = tmpInput.ptr();
|
||||
const q7_t *inp = input.ptr();
|
||||
|
||||
memcpy(tmpin,inp,input.nbSamples());
|
||||
|
||||
|
||||
}
|
||||
|
||||
void PoolingBench::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
|
||||
{
|
||||
|
||||
}
|
||||
Binary file not shown.
@ -1,2 +1,2 @@
|
||||
OPTIMIZED,HARDFP,FASTMATH,NEON,UNROLL,ROUNDING,PLATFORM,CORE,COMPILER,VERSION
|
||||
1,1,1,0,1,0,FVP,ARMCM7_DP,AC6,6120001
|
||||
1,1,1,1,1,0,FVP,ARMCA5,AC6,6120001
|
||||
|
||||
|
Loading…
Reference in New Issue