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.

convolution3d.h 1.7 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * \file dnn/test/common/convolution3d.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/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 convolution3d {
  20. struct TestArg {
  21. param::Convolution3D param;
  22. TensorShape src, filter;
  23. TestArg(param::Convolution3D param, TensorShape src, TensorShape filter)
  24. : param(param), src(src), filter(filter) {}
  25. };
  26. std::vector<TestArg> get_args();
  27. std::vector<TestArg> get_1x1x1_args();
  28. std::vector<TestArg> get_dilated_args();
  29. std::vector<TestArg> get_chanwise_args();
  30. std::vector<TestArg> get_speed_test_args();
  31. //! \param stage 0 for fwd, 1 for bwd data, 2 for bwd filter
  32. using ConvEPSGetter =
  33. std::function<float(bool f16, int stage, const char* algo_name)>;
  34. //! check for various conv configurations (dilation, group, stride, padding)
  35. //! and run all usable algorithms
  36. void test_conv_config_combinations(
  37. Handle* handle, bool test_int8, bool test_backward, bool is_cuda,
  38. ConvEPSGetter conv_eps_getter = [](bool f16, int, const char*)
  39. -> float { return f16 ? 1e-1 : 1e-3; });
  40. } // namespace convolution3d
  41. } // namespace test
  42. } // namespace megdnn
  43. // vim: syntax=cpp.doxygen

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