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.

warp_perspective.cpp 1.1 kB

123456789101112131415161718192021222324252627282930313233
  1. #include "test/cpu/fixture.h"
  2. #include "megdnn/oprs/imgproc.h"
  3. #include "test/common/null_dispatcher.h"
  4. #include "test/common/utils.h"
  5. namespace megdnn {
  6. namespace test {
  7. #if !MEGDNN_NO_THREAD
  8. TEST(DISPATCHER, WARP_PERSPECTIVE) {
  9. std::shared_ptr<MegcoreCPUDispatcher> dispatcher =
  10. std::make_shared<NullDispatcher>();
  11. auto handle = create_cpu_handle_with_dispatcher(0, dispatcher);
  12. auto opr = handle->create_operator<WarpPerspective>();
  13. auto src_layout = TensorLayout({2, 3, 10, 10}, dtype::Float32()),
  14. mat_layout = TensorLayout({2, 3, 3}, dtype::Float32()),
  15. dst_layout = TensorLayout({2, 3, 10, 10}, dtype::Float32());
  16. TensorND src(nullptr, src_layout), mat(nullptr, mat_layout),
  17. dst(nullptr, dst_layout);
  18. opr->param().imode = param::WarpPerspective::InterpolationMode::LINEAR;
  19. auto wsize = opr->get_workspace_in_bytes(src_layout, mat_layout, dst_layout);
  20. Workspace workspace(nullptr, wsize);
  21. opr->exec(src, mat, dst, workspace);
  22. }
  23. #endif
  24. } // namespace test
  25. } // namespace megdnn
  26. // vim: syntax=cpp.doxygen