PoolingBench.cpp 2.0 KB

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