FullyConnectedBench.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #include "FullyConnectedBench.h"
  2. #include "Error.h"
  3. #include "arm_nnfunctions.h"
  4. void FullyConnectedBench::test_fully_connected_tflite_s8()
  5. {
  6. for(int i=0; i < this->repeatNb; i++)
  7. {
  8. arm_fully_connected_s8((int8_t*)this->inp
  9. ,(const int8_t*)this->weightp
  10. ,colDim
  11. ,rowDim
  12. ,nb_batches
  13. ,input_offset
  14. ,filter_offset
  15. ,output_mult
  16. ,output_shift
  17. ,output_offset
  18. ,(const int32_t*)this->biasp
  19. ,(int8_t*)this->outp
  20. ,act_min
  21. ,act_max
  22. ,this->tempp
  23. );
  24. }
  25. }
  26. void FullyConnectedBench::setUp(Testing::testID_t,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
  27. {
  28. std::vector<Testing::param_t>::iterator it = params.begin();
  29. this->repeatNb = *it;
  30. output_mult = 1077969154;
  31. output_shift = 2;
  32. filter_offset = 0;
  33. input_offset = 0;
  34. output_offset = 1;
  35. act_min =-128;
  36. act_max= 127;
  37. nb_batches=8;
  38. colDim=8;
  39. rowDim=5;
  40. input.reload(FullyConnectedBench::INPUT13_S8_ID,mgr);
  41. bias.reload(FullyConnectedBench::BIAS13_S8_ID,mgr);
  42. weight.reload(FullyConnectedBench::WEIGHT13_S8_ID,mgr);
  43. //ref.reload(FullyConnectedBench::REF13_S8_ID,mgr);
  44. output.create(ref.nbSamples(),FullyConnectedBench::OUTPUT_S8_ID,mgr);
  45. temp.create(colDim,FullyConnectedBench::TEMP_S16_ID,mgr);
  46. this->inp=input.ptr();
  47. this->biasp=bias.ptr();
  48. this->weightp=weight.ptr();
  49. this->outp=output.ptr();
  50. //this->refp=ref.ptr();
  51. this->tempp=temp.ptr();
  52. }
  53. void FullyConnectedBench::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  54. {
  55. }