1 #include "PoolingBench.h"
2 #include "Error.h"
3 #include "arm_nnfunctions.h"
4 #include "Test.h"
5 
6 #include <cstdio>
7 
8 
test_avgpool_s8()9     void PoolingBench::test_avgpool_s8()
10     {
11 
12       //for(int i=0; i < this->repeatNb; i++)
13       {
14        arm_avgpool_s8(
15            DIM_IN_Y,
16            DIM_IN_X,
17            DIM_OUT_Y,
18            DIM_OUT_X,
19            STRIDE_Y,
20            STRIDE_X,
21            DIM_FILTER_Y,
22            DIM_FILTER_X,
23            PAD_HEIGHT,
24            PAD_WIDTH,
25            ACT_MIN,
26            ACT_MAX,
27            IN_CHANNEL,
28            tmpin,
29            tempp,
30            outp);
31 
32        }
33 
34        //ASSERT_EQ(this->ref,this->output);
35 
36     }
37 
38 
setUp(Testing::testID_t id,std::vector<Testing::param_t> & paramsArgs,Client::PatternMgr * mgr)39     void PoolingBench::setUp(Testing::testID_t id,std::vector<Testing::param_t>& paramsArgs,Client::PatternMgr *mgr)
40     {
41 
42        std::vector<Testing::param_t>::iterator it = paramsArgs.begin();
43        this->repeatNb = *it;
44 
45        switch(id)
46        {
47           case PoolingBench::TEST_AVGPOOL_S8_1:
48             input.reload(PoolingBench::INPUT1_S8_ID,mgr);
49             ref.reload(PoolingBench::REF1_S8_ID,mgr);
50 
51             this->DIM_IN_X= 4;
52             this->DIM_IN_Y= 2;
53             this->DIM_OUT_X= 2;
54             this->DIM_OUT_Y= 1;
55             this->IN_CHANNEL= 101;
56             this->DIM_FILTER_X= 2;
57             this->DIM_FILTER_Y= 2;
58             this->PAD_WIDTH=  0;
59             this->PAD_HEIGHT= 0;
60             this->STRIDE_X= 2;
61             this->STRIDE_Y= 2;
62             this->ACT_MIN= -128;
63             this->ACT_MAX= 127;
64 
65           break;
66 
67 
68        }
69        temp.create(this->DIM_OUT_X * this->IN_CHANNEL,PoolingBench::TEMP_S8_ID,mgr);
70 
71        output.create(ref.nbSamples(),PoolingBench::OUTPUT_S8_ID,mgr);
72        tmpInput.create(input.nbSamples(),PoolingBench::TEMPINPUT_S8_ID,mgr);
73 
74        const q7_t *inp = input.ptr();
75 
76 
77        this->tmpin = tmpInput.ptr();
78        this->outp = output.ptr();
79        this->tempp = temp.ptr();
80 
81        memcpy(tmpin,inp,input.nbSamples());
82 
83     }
84 
tearDown(Testing::testID_t id,Client::PatternMgr * mgr)85     void PoolingBench::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
86     {
87 
88     }
89