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_io_options.cpp 2.1 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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_string(input);
  8. DECLARE_int32(batch_size);
  9. DECLARE_int32(iter);
  10. namespace {
  11. STRING_OPTION_WRAP(input, "");
  12. INT32_OPTION_WRAP(batch_size, -1);
  13. BOOL_OPTION_WRAP(lite);
  14. INT32_OPTION_WRAP(iter, 10);
  15. } // anonymous namespace
  16. TEST(TestLarIO, INPUT) {
  17. DEFINE_INT32_WRAP(iter, 1);
  18. {
  19. std::string model_path = "./resnet50.mge";
  20. TEST_STRING_OPTION(input, "data:./resnet50_input.npy");
  21. }
  22. {
  23. std::string model_path = "./add_demo.mge";
  24. TEST_STRING_OPTION(input, "data:add_demo_input.json");
  25. }
  26. {
  27. std::string model_path = "./resnet50_uint8.mge";
  28. TEST_STRING_OPTION(input, "data:./cat.ppm");
  29. }
  30. {
  31. std::string model_path = "./add_demo.mge";
  32. TEST_STRING_OPTION(input, "data:[2.0,3.0,4.0]");
  33. }
  34. {
  35. std::string model_path = "./shufflenet.mge";
  36. TEST_STRING_OPTION(input, "data:{2,3,224,224}");
  37. }
  38. {
  39. std::string model_path = "./resnet50_b10.mdl";
  40. TEST_INT32_OPTION(batch_size, 1);
  41. TEST_INT32_OPTION(batch_size, 5);
  42. TEST_INT32_OPTION(batch_size, 11);
  43. }
  44. }
  45. TEST(TestLarIO, INPUT_LITE) {
  46. DEFINE_INT32_WRAP(iter, 1);
  47. DEFINE_BOOL_WRAP(lite);
  48. {
  49. std::string model_path = "./resnet50.mge";
  50. TEST_STRING_OPTION(input, "data:./resnet50_input.npy");
  51. }
  52. {
  53. std::string model_path = "./add_demo.mge";
  54. TEST_STRING_OPTION(input, "data:add_demo_input.json");
  55. }
  56. {
  57. std::string model_path = "./resnet50_uint8.mge";
  58. TEST_STRING_OPTION(input, "data:./cat.ppm");
  59. }
  60. {
  61. std::string model_path = "./add_demo.mge";
  62. TEST_STRING_OPTION(input, "data:[2.0,3.0,4.0]");
  63. }
  64. {
  65. std::string model_path = "./shufflenet.mge";
  66. TEST_STRING_OPTION(input, "data:{2,3,224,224}");
  67. }
  68. {
  69. std::string model_path = "./resnet50_b10.mdl";
  70. TEST_INT32_OPTION(batch_size, 1);
  71. TEST_INT32_OPTION(batch_size, 5);
  72. TEST_INT32_OPTION(batch_size, 11);
  73. }
  74. }