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.

softmax.cpp 2.8 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "test/fallback/fixture.h"
  2. #include "megdnn/oprs.h"
  3. #include "test/common/benchmarker.h"
  4. #include "test/common/checker.h"
  5. #include "test/common/task_record_check.h"
  6. #include "test/common/tensor.h"
  7. #include "test/common/workspace_wrapper.h"
  8. namespace megdnn {
  9. namespace test {
  10. TEST_F(FALLBACK, SOFTMAX_FORWARD) {
  11. Checker<Softmax> checker(handle());
  12. Softmax::Param param0{0};
  13. checker.set_param(param0).exec(TensorShapeArray{{11}, {}});
  14. checker.set_param(param0).exec(TensorShapeArray{{11, 11}, {}});
  15. checker.set_param(param0).exec(TensorShapeArray{{11, 11, 11}, {}});
  16. checker.set_param(param0).exec(TensorShapeArray{{11, 11, 11, 11}, {}});
  17. checker.set_param(param0).exec(TensorShapeArray{{11, 11, 11, 11, 11}, {}});
  18. checker.set_param(param0).exec(TensorShapeArray{{11, 7, 5, 5, 5, 11}, {}});
  19. checker.set_param(param0).exec(TensorShapeArray{{11, 7, 5, 7, 5, 7, 7}, {}});
  20. Softmax::Param param1{1};
  21. checker.set_param(param1).exec(TensorShapeArray{{11, 11}, {}});
  22. checker.set_param(param1).exec(TensorShapeArray{{11, 11, 11}, {}});
  23. checker.set_param(param1).exec(TensorShapeArray{{11, 11, 11, 11}, {}});
  24. checker.set_param(param1).exec(TensorShapeArray{{11, 11, 11, 11, 11}, {}});
  25. checker.set_param(param1).exec(TensorShapeArray{{11, 5, 5, 5, 5, 11}, {}});
  26. checker.set_param(param1).exec(TensorShapeArray{{11, 7, 5, 7, 5, 7, 7}, {}});
  27. Softmax::Param param2{2};
  28. checker.set_param(param2).exec(TensorShapeArray{{11, 11, 11}, {}});
  29. checker.set_param(param2).exec(TensorShapeArray{{11, 11, 11, 11}, {}});
  30. checker.set_param(param2).exec(TensorShapeArray{{11, 11, 11, 11, 11}, {}});
  31. checker.set_param(param2).exec(TensorShapeArray{{11, 5, 5, 5, 5, 11}, {}});
  32. checker.set_param(param2).exec(TensorShapeArray{{11, 5, 5, 5, 5, 7, 7}, {}});
  33. Softmax::Param param3{3};
  34. checker.set_param(param3).exec(TensorShapeArray{{11, 11, 11, 11}, {}});
  35. checker.set_param(param3).exec(TensorShapeArray{{11, 11, 11, 11, 11}, {}});
  36. checker.set_param(param3).exec(TensorShapeArray{{11, 5, 5, 5, 5, 11}, {}});
  37. checker.set_param(param3).exec(TensorShapeArray{{11, 5, 5, 5, 5, 7, 7}, {}});
  38. Softmax::Param param4{4};
  39. checker.set_param(param4).exec(TensorShapeArray{{11, 11, 11, 11, 11}, {}});
  40. checker.set_param(param4).exec(TensorShapeArray{{11, 5, 5, 5, 5, 11}, {}});
  41. checker.set_param(param4).exec(TensorShapeArray{{11, 5, 5, 5, 5, 7, 7}, {}});
  42. Softmax::Param param5{5};
  43. checker.set_param(param5).exec(TensorShapeArray{{11, 5, 5, 5, 5, 11}, {}});
  44. checker.set_param(param5).exec(TensorShapeArray{{11, 5, 5, 5, 5, 7, 7}, {}});
  45. Softmax::Param param6{6};
  46. checker.set_param(param6).exec(TensorShapeArray{{11, 5, 5, 5, 5, 7, 7}, {}});
  47. }
  48. } // namespace test
  49. } // namespace megdnn
  50. // vim: syntax=cpp.doxygen