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.

elemwise.h 1.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * \file dnn/test/common/elemwise.h
  3. * MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
  4. *
  5. * Copyright (c) 2014-2020 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/handle.h"
  13. #include <gtest/gtest.h>
  14. #include "test/common/fix_gtest_on_platforms_without_exception.inl"
  15. namespace megdnn {
  16. namespace test {
  17. namespace elemwise {
  18. // clang-format off
  19. #define FIRST_ELEMWISE_CASE unary
  20. #define FOREACH_ELEMWISE_NONFIRST_CASE(cb) \
  21. cb(binary_brdcst) \
  22. cb(binary_non_contig) \
  23. cb(ternary) \
  24. cb(ternary_non_contig) \
  25. cb(fuse_mul_add3) \
  26. cb(fuse_mul_add3_non_contig) \
  27. cb(fuse_mul_add4) \
  28. cb(rmulh) \
  29. cb(unary1) \
  30. cb(binary1) \
  31. cb(ternary1) \
  32. cb(unary2) \
  33. cb(binary2) \
  34. cb(ternary2) \
  35. cb(unary3) \
  36. cb(binary3) \
  37. cb(all_modes) \
  38. #define FOREACH_ELEMWISE_CASE(cb) \
  39. cb(FIRST_ELEMWISE_CASE) \
  40. FOREACH_ELEMWISE_NONFIRST_CASE(cb)
  41. #define def_tags(name) struct name{};
  42. FOREACH_ELEMWISE_CASE(def_tags);
  43. #undef def_tags
  44. template<typename tag>
  45. void run_test(Handle *handle);
  46. #define t(n) ,n
  47. typedef ::testing::Types<FIRST_ELEMWISE_CASE
  48. FOREACH_ELEMWISE_NONFIRST_CASE(t)> test_types;
  49. #undef t
  50. // clang-format on
  51. } // namespace elemwise
  52. } // namespace test
  53. } // namespace megdnn
  54. // vim: syntax=cpp.doxygen

MegEngine 安装包中集成了使用 GPU 运行代码所需的 CUDA 环境,不用区分 CPU 和 GPU 版。 如果想要运行 GPU 程序,请确保机器本身配有 GPU 硬件设备并安装好驱动。 如果你想体验在云端 GPU 算力平台进行深度学习开发的感觉,欢迎访问 MegStudio 平台