You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_power.cpp 1.1 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2022 Tencent
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. #include "testutil.h"
  4. static int test_power(const ncnn::Mat& a)
  5. {
  6. ncnn::ParamDict pd;
  7. pd.set(0, 1.1f);
  8. pd.set(1, 1.5f);
  9. pd.set(2, 2.0f);
  10. std::vector<ncnn::Mat> weights(0);
  11. int ret = test_layer("Power", pd, weights, a);
  12. if (ret != 0)
  13. {
  14. fprintf(stderr, "test_power failed a.dims=%d a=(%d %d %d)\n", a.dims, a.w, a.h, a.c);
  15. }
  16. return ret;
  17. }
  18. static int test_power_0()
  19. {
  20. return 0
  21. || test_power(RandomMat(5, 7, 24))
  22. || test_power(RandomMat(7, 9, 12))
  23. || test_power(RandomMat(3, 5, 13));
  24. }
  25. static int test_power_1()
  26. {
  27. return 0
  28. || test_power(RandomMat(15, 24))
  29. || test_power(RandomMat(19, 12))
  30. || test_power(RandomMat(17, 15));
  31. }
  32. static int test_power_2()
  33. {
  34. return 0
  35. || test_power(RandomMat(128))
  36. || test_power(RandomMat(124))
  37. || test_power(RandomMat(127));
  38. }
  39. int main()
  40. {
  41. SRAND(7767517);
  42. return 0
  43. || test_power_0()
  44. || test_power_1()
  45. || test_power_2();
  46. }