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.

sliding_window_transpose.cpp 1.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "test/naive/fixture.h"
  2. #include "megdnn/oprs/nn.h"
  3. #include "test/common/checker.h"
  4. using namespace megdnn;
  5. using namespace test;
  6. TEST_F(NAIVE, SlidingWindowTranspose_FORWARD) {
  7. Checker<SlidingWindowTranspose> checker(handle(), /* check_dispatch */ false);
  8. SlidingWindowTranspose::Param param(3, 3, 0, 0, 1, 1, 1, 1, 2, 2);
  9. checker.set_param(param).exect(
  10. Testcase{
  11. TensorValue(
  12. {1, 1, 2, 2, 2, 2}, dtype::Uint8(),
  13. {0, 1, 3, 4, 1, 2, 4, 5, 3, 4, 6, 7, 4, 5, 7, 8}),
  14. {}},
  15. Testcase{
  16. {},
  17. TensorValue(
  18. {1, 1, 3, 3}, dtype::Uint8(),
  19. {0, 2, 2, 6, 16, 10, 6, 14, 8})});
  20. param.out_h = 6;
  21. param.out_w = 7;
  22. param.pad_h = 1;
  23. param.pad_w = 1;
  24. param.stride_h = 2;
  25. param.stride_w = 2;
  26. param.dilate_h = 2;
  27. param.dilate_w = 2;
  28. param.window_h = 3;
  29. param.window_w = 3;
  30. checker.set_param(param).exect(
  31. Testcase{
  32. TensorValue(
  33. {1, 1, 2, 3, 3, 3}, dtype::Uint8(),
  34. {0, 0, 0, 0, 8, 10, 0, 22, 24, 0, 0, 0, 8, 10,
  35. 12, 22, 24, 26, 0, 0, 0, 10, 12, 0, 24, 26, 0, 0,
  36. 8, 10, 0, 22, 24, 0, 36, 38, 8, 10, 12, 22, 24, 26,
  37. 36, 38, 40, 10, 12, 0, 24, 26, 0, 38, 40, 0}),
  38. {}},
  39. Testcase{
  40. {},
  41. TensorValue(
  42. {1, 1, 6, 7}, dtype::Uint8(),
  43. {0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 60, 0, 48, 0,
  44. 0, 0, 0, 0, 0, 0, 0, 0, 88, 0, 144, 0, 104, 0,
  45. 0, 0, 0, 0, 0, 0, 0, 0, 72, 0, 114, 0, 80, 0})});
  46. }