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_deepcopy.cpp 1.1 kB

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