PoolingBench.cpp 2.0 KB

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