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.

convolution.h 2.4 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /**
  2. * \file dnn/test/common/convolution.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/opr_param_defs.h"
  13. #include "megdnn/basic_types.h"
  14. #include "megdnn/handle.h"
  15. #include "test/common/checker.h"
  16. #include <gtest/gtest.h>
  17. namespace megdnn {
  18. namespace test {
  19. namespace convolution {
  20. struct TestArg {
  21. param::Convolution param;
  22. TensorShape src, filter;
  23. TestArg(param::Convolution param, TensorShape src, TensorShape filter)
  24. : param(param), src(src), filter(filter) {}
  25. };
  26. std::vector<TestArg> get_args_common();
  27. std::vector<TestArg> get_args_padding();
  28. std::vector<TestArg> get_args_large_channel();
  29. std::vector<TestArg> get_args_1x1();
  30. std::vector<TestArg> get_args_large_filter();
  31. std::vector<TestArg> get_args_exhaustive_search();
  32. std::vector<TestArg> get_args_4x4();
  33. std::vector<TestArg> get_args_large_channels();
  34. std::vector<TestArg> get_args_x86_direct_case_2();
  35. std::vector<TestArg> get_args_fallback_templated_impl();
  36. std::vector<TestArg> get_args_fallback_non_templated_impl();
  37. std::vector<TestArg> get_args_cudnn_5_1_failures();
  38. std::vector<TestArg> get_args_x86_winograd_algorithm();
  39. std::vector<TestArg> get_args_BRAIN_481();
  40. std::vector<TestArg> get_args();
  41. std::vector<TestArg> get_args_cuda_conv_bwd_data();
  42. std::vector<TestArg> get_args_cudnn_7_5_failures();
  43. std::vector<TestArg> get_1x1_args();
  44. std::vector<TestArg> get_dilated_args();
  45. std::vector<TestArg> get_chanwise_args();
  46. //! \param stage 0 for fwd, 1 for bwd data, 2 for bwd filter
  47. using ConvEPSGetter =
  48. std::function<float(bool f16, int stage, const char* algo_name)>;
  49. //! check for various conv configurations (dilation, group, stride, padding)
  50. //! and run all usable algorithms
  51. void test_conv_config_combinations(
  52. Handle* handle, bool test_int8, bool test_backward, bool is_cuda,
  53. ConvEPSGetter conv_eps_getter = [](bool f16, int, const char*)
  54. -> float { return f16 ? 1e-1 : 1e-3; },
  55. bool use_io16xc32 = false);
  56. } // namespace convolution
  57. } // namespace test
  58. } // namespace megdnn
  59. // vim: syntax=cpp.doxygen

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

Contributors (1)