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_layout_options.cpp 2.2 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #include <gtest/gtest.h>
  2. #include <string.h>
  3. #include <memory>
  4. #include "test_options.h"
  5. using namespace lar;
  6. DECLARE_bool(lite);
  7. DECLARE_bool(cpu);
  8. #if LITE_WITH_CUDA
  9. DECLARE_bool(cuda);
  10. #endif
  11. DECLARE_bool(enable_nchw4);
  12. DECLARE_bool(enable_chwn4);
  13. DECLARE_bool(enable_nchw44);
  14. DECLARE_bool(enable_nchw88);
  15. DECLARE_bool(enable_nchw32);
  16. DECLARE_bool(enable_nchw64);
  17. DECLARE_bool(enable_nhwcd4);
  18. DECLARE_bool(enable_nchw44_dot);
  19. namespace {
  20. BOOL_OPTION_WRAP(enable_nchw4);
  21. BOOL_OPTION_WRAP(enable_chwn4);
  22. BOOL_OPTION_WRAP(enable_nchw44);
  23. BOOL_OPTION_WRAP(enable_nchw88);
  24. BOOL_OPTION_WRAP(enable_nchw32);
  25. BOOL_OPTION_WRAP(enable_nchw64);
  26. BOOL_OPTION_WRAP(enable_nhwcd4);
  27. BOOL_OPTION_WRAP(enable_nchw44_dot);
  28. BOOL_OPTION_WRAP(lite);
  29. BOOL_OPTION_WRAP(cpu);
  30. #if LITE_WITH_CUDA
  31. BOOL_OPTION_WRAP(cuda);
  32. #endif
  33. } // anonymous namespace
  34. TEST(TestLarLayout, X86_CPU) {
  35. DEFINE_WRAP(cpu);
  36. std::string model_path = "./shufflenet.mge";
  37. TEST_BOOL_OPTION(enable_nchw4);
  38. TEST_BOOL_OPTION(enable_chwn4);
  39. TEST_BOOL_OPTION(enable_nchw44);
  40. TEST_BOOL_OPTION(enable_nchw44_dot);
  41. TEST_BOOL_OPTION(enable_nchw64);
  42. TEST_BOOL_OPTION(enable_nchw32);
  43. TEST_BOOL_OPTION(enable_nchw88);
  44. }
  45. TEST(TestLarLayout, X86_CPU_LITE) {
  46. DEFINE_WRAP(cpu);
  47. DEFINE_WRAP(lite);
  48. std::string model_path = "./shufflenet.mge";
  49. TEST_BOOL_OPTION(enable_nchw4);
  50. TEST_BOOL_OPTION(enable_nchw44);
  51. TEST_BOOL_OPTION(enable_nchw44_dot);
  52. TEST_BOOL_OPTION(enable_nchw64);
  53. TEST_BOOL_OPTION(enable_nchw32);
  54. TEST_BOOL_OPTION(enable_nchw88);
  55. }
  56. #if LITE_WITH_CUDA
  57. TEST(TestLarLayout, CUDA) {
  58. DEFINE_WRAP(cuda);
  59. std::string model_path = "./shufflenet.mge";
  60. TEST_BOOL_OPTION(enable_nchw4);
  61. TEST_BOOL_OPTION(enable_chwn4);
  62. TEST_BOOL_OPTION(enable_nchw64);
  63. TEST_BOOL_OPTION(enable_nchw32);
  64. FLAGS_cuda = false;
  65. }
  66. TEST(TestLarLayout, CUDA_LITE) {
  67. DEFINE_WRAP(cuda);
  68. DEFINE_WRAP(lite);
  69. std::string model_path = "./shufflenet.mge";
  70. TEST_BOOL_OPTION(enable_nchw4);
  71. TEST_BOOL_OPTION(enable_nchw64);
  72. TEST_BOOL_OPTION(enable_nchw32);
  73. }
  74. #endif
  75. // vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}