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

Function TEST_F

dnn/test/cuda/group_conv.cpp:13–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11namespace test {
12
13TEST_F(CUDA, GROUP_CONV_FORWARD) {
14 bool is_int_available = check_compute_capability(6, 1);
15 auto run = [&](size_t N, size_t IC, size_t IH, size_t IW, size_t FH, size_t FW,
16 size_t OC, size_t /* OH */, size_t /* OW */, size_t PH, size_t PW,
17 size_t SH, size_t SW, size_t DH, size_t DW, size_t group) {
18 {
19 // float case
20 Checker<Convolution> checker(handle_cuda());
21 Convolution::Param param;
22 param.sparse = Convolution::Param::Sparse::GROUP;
23 param.pad_h = PH;
24 param.pad_w = PW;
25 param.stride_h = SH;
26 param.stride_w = SW;
27 param.dilate_h = DH;
28 param.dilate_w = DW;
29 auto ICg = IC / group;
30 auto OCg = OC / group;
31 checker.set_param(param).exec(
32 {{N, IC, IH, IW}, {group, OCg, ICg, FH, FW}, {}});
33 }
34 if (is_int_available) {
35 // int 8x8x32 case
36 Checker<Convolution> checker(handle_cuda());
37 Convolution::Param param;
38 param.sparse = Convolution::Param::Sparse::GROUP;
39 param.format = Convolution::Param::Format::NHWC;
40 param.pad_h = PH;
41 param.pad_w = PW;
42 param.stride_h = SH;
43 param.stride_w = SW;
44 param.dilate_h = DH;
45 param.dilate_w = DW;
46 auto ICg = IC / group;
47 auto OCg = OC / group;
48 UniformIntRNG rng(-4, 4);
49 checker.set_param(param)
50 .set_dtype(0, dtype::Int8())
51 .set_dtype(1, dtype::Int8())
52 .set_dtype(2, dtype::Int32())
53 .set_rng(0, &rng)
54 .set_rng(1, &rng)
55 .exec({{N, IH, IW, IC}, {group, OCg, FH, FW, ICg}, {}});
56 }
57 };
58 // normal case
59 run(2, 64, 7, 7, 3, 3, 32, 5, 5, 0, 0, 1, 1, 1, 1, 2);
60 // padded case
61 run(2, 32, 7, 7, 3, 3, 64, 7, 7, 1, 1, 1, 1, 1, 1, 4);
62 // strided case
63 run(2, 32, 7, 7, 3, 3, 64, 3, 3, 0, 0, 2, 2, 1, 1, 8);
64 // dilated case
65 run(2, 32, 7, 7, 3, 3, 64, 3, 3, 0, 0, 1, 1, 2, 2, 8);
66}
67
68TEST_F(CUDA, GROUP_CONV_FORWARD_1x1) {
69 auto run = [&](size_t N, size_t IC, size_t IH, size_t IW, size_t FH, size_t FW,

Callers

nothing calls this directly

Calls 4

check_compute_capabilityFunction · 0.85
set_dtypeMethod · 0.80
runFunction · 0.50
execMethod · 0.45

Tested by

no test coverage detected