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.

relayout.h 1.5 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * \file dnn/test/common/relayout.h
  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. #pragma once
  12. #include "megdnn/basic_types.h"
  13. #include "megdnn/handle.h"
  14. #include "megdnn/opr_param_defs.h"
  15. #include <gtest/gtest.h>
  16. namespace megdnn {
  17. namespace test {
  18. namespace relayout {
  19. // clang-format off
  20. #define FIRST_RELAYOUT_CASE cv
  21. #define FOREACH_RELAYOUT_NONFIRST_CASE(cb) \
  22. cb(cv_ch3) \
  23. cb(cv_ch5) \
  24. cb(broadcast) \
  25. cb(negative) \
  26. cb(transpose) \
  27. #define FOREACH_RELAYOUT_CASE(cb) \
  28. cb(FIRST_RELAYOUT_CASE) \
  29. FOREACH_RELAYOUT_NONFIRST_CASE(cb)
  30. #define def_tags(name) struct name{};
  31. FOREACH_RELAYOUT_CASE(def_tags);
  32. #undef def_tags
  33. template<typename tag>
  34. void run_test(Handle *handle);
  35. #define t(n) ,n
  36. typedef ::testing::Types<FIRST_RELAYOUT_CASE
  37. FOREACH_RELAYOUT_NONFIRST_CASE(t)> test_types;
  38. #undef t
  39. // clang-format on
  40. struct TestArg {
  41. TensorLayout src;
  42. TensorLayout dst;
  43. TestArg() = default;
  44. TestArg(TensorLayout src_, TensorLayout dst_) : src(src_), dst(dst_) {}
  45. };
  46. void run_cv_benchmark(Handle* handle);
  47. } // namespace relayout
  48. } // namespace test
  49. } // namespace megdnn
  50. // vim: syntax=cpp.doxygen