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.

null.cpp 1.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * \file dnn/test/dispatcher/null.cpp
  3. * MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
  4. *
  5. * Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
  6. *
  7. * Unless required by applicable law or agreed to in writing,
  8. * software distributed under the License is distributed on an
  9. * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. */
  11. #include <gtest/gtest.h>
  12. #include "megdnn/oprs.h"
  13. #include "test/common/null_dispatcher.h"
  14. #include "test/common/tensor.h"
  15. #include "test/common/utils.h"
  16. #include "test/common/workspace_wrapper.h"
  17. namespace megdnn {
  18. namespace test {
  19. #if !MEGDNN_NO_THREAD
  20. TEST(DISPATCHER, NULL_DISPATCHER) {
  21. std::shared_ptr<MegcoreCPUDispatcher> dispatcher =
  22. std::make_shared<NullDispatcher>();
  23. auto handle = create_cpu_handle_with_dispatcher(0, dispatcher);
  24. auto opr = handle->create_operator<Convolution>();
  25. auto layout = TensorLayout({1, 1, 1, 1}, dtype::Float32());
  26. TensorND src(nullptr, layout), filter(nullptr, layout), dst(nullptr, layout);
  27. auto wsize = opr->get_workspace_in_bytes(layout, layout, layout, nullptr);
  28. Workspace workspace(nullptr, wsize);
  29. opr->exec(src, filter, dst, nullptr, workspace);
  30. }
  31. #endif
  32. } // namespace test
  33. } // namespace megdnn
  34. // vim: syntax=cpp.doxygen