MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / get_conv_bias_benchmaker_args

Function get_conv_bias_benchmaker_args

dnn/test/aarch64/conv_bias.cpp:49–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47
48#if MEGDNN_WITH_BENCHMARK
49std::vector<conv_bias::TestArg> get_conv_bias_benchmaker_args(
50 std::vector<size_t> kernel, size_t stride) {
51 using namespace conv_bias;
52 using Param = param::ConvBias;
53 using NLMode = param::ConvBias::NonlineMode;
54
55 std::vector<TestArg> args;
56 auto pack = [&](size_t oc, size_t ic, size_t w, size_t h, size_t kernel,
57 size_t stride, NLMode nonline_mode) {
58 Param param;
59 param.stride_h = stride;
60 param.stride_w = stride;
61 param.pad_h = kernel == 1 ? 0 : kernel / 2;
62 param.pad_w = kernel == 1 ? 0 : kernel / 2;
63 param.nonlineMode = nonline_mode;
64 //! no bias
65 args.emplace_back(
66 param, TensorShape{1, ic, h, w}, TensorShape{oc, ic, kernel, kernel},
67 TensorShape{});
68 //! bias broadcast channle
69 args.emplace_back(
70 param, TensorShape{1, ic, h, w}, TensorShape{oc, ic, kernel, kernel},
71 TensorShape{1, oc, 1, 1});
72 //! bias
73 args.emplace_back(
74 param, TensorShape{1, ic, h, w}, TensorShape{oc, ic, kernel, kernel},
75 TensorShape{
76 1, oc, (h + 2 * param.pad_h - kernel) / stride + 1,
77 (w + 2 * param.pad_w - kernel) / stride + 1});
78 };
79
80 for (auto nlmode : {NLMode::IDENTITY, NLMode::RELU, NLMode::SIGMOID}) {
81 for (size_t k : kernel) {
82 for (size_t ic : {3, 6, 12, 24}) {
83 for (size_t oc : {3, 6, 12, 24}) {
84 for (size_t size : {4, 7, 8, 14, 16, 17, 28, 32, 34, 64, 112}) {
85 pack(oc, ic, size, size, k, stride, nlmode);
86 }
87 }
88 }
89 }
90 }
91 return args;
92}
93
94void benchmarker_conv_bias(
95 std::vector<conv_bias::TestArg> args, Handle* handle, const char* algo_name,

Callers 1

TEST_FFunction · 0.85

Calls 2

packFunction · 0.85
emplace_backMethod · 0.80

Tested by

no test coverage detected