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 <gtest/gtest.h>
  13. #include "megdnn/basic_types.h"
  14. #include "megdnn/handle.h"
  15. #include "megdnn/opr_param_defs.h"
  16. #include "test/common/checker.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 = std::function<float(bool f16, int stage, const char* algo_name)>;
  33. //! check for various conv configurations (dilation, group, stride, padding)
  34. //! and run all usable algorithms
  35. void test_conv_config_combinations(
  36. Handle* handle, bool test_int8, bool test_backward, bool is_cuda,
  37. ConvEPSGetter conv_eps_getter = [](bool f16, int, const char*) -> float {
  38. return f16 ? 1e-1 : 1e-3;
  39. });
  40. } // namespace convolution3d
  41. } // namespace test
  42. } // namespace megdnn
  43. // vim: syntax=cpp.doxygen