PoolingBench.cpp 2.0 KB

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