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

Function TEST_F

dnn/test/aarch64/convolution.cpp:12–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace test;
11#if __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
12TEST_F(AARCH64, CONVOLUTION_BACKWARD_DATA_FP16) {
13 Checker<ConvolutionBackwardData> checker(handle());
14 using Param = ConvolutionBackwardData::Param;
15 Param param;
16 auto run = [&](size_t n, size_t ic, size_t oh, size_t ow, size_t oc, size_t fh,
17 size_t fw, size_t stride, size_t padding, size_t group = 1) {
18 param.pad_h = param.pad_w = padding;
19 param.stride_h = param.stride_w = stride;
20
21 TensorLayout diff = TensorLayout{{n, oc * group, oh, ow}, dtype::Float16()};
22 TensorLayout grad;
23 TensorLayout filter;
24 if (group == 1) {
25 param.sparse = Param::Sparse::DENSE;
26 filter = {{oc, ic, fh, fw}, dtype::Float16()};
27 } else {
28 param.sparse = Param::Sparse::GROUP;
29 filter = {{group, oc, ic, fh, fw}, dtype::Float16()};
30 }
31 // TensorLayout grad;
32 {
33 auto opr = handle()->create_operator<ConvolutionBackwardData>();
34 opr->param() = param;
35 opr->deduce_layout(filter, diff, grad);
36 }
37 NormalRNG rng(10.f);
38 checker.set_param(param)
39 .set_dtype(0, dtype::Float16())
40 .set_dtype(1, dtype::Float16())
41 .set_dtype(2, dtype::Float16())
42 .set_rng(0, &rng)
43 .set_rng(1, &rng)
44 .set_epsilon(1e-2)
45 .set_before_exec_callback(
46 AlgoChecker<ConvolutionBackwardData>("DeconvMatmul"));
47 checker.exec(TensorLayoutArray{filter, diff, grad});
48 };
49
50 for (auto mode : {Param::Mode::CONVOLUTION, Param::Mode::CROSS_CORRELATION}) {
51 param.mode = mode;
52 run(4, 3, 10, 13, 5, 1, 1, 1, 0, 1);
53 run(4, 3, 10, 45, 2, 1, 1, 1, 0, 4);
54 run(2, 3, 9, 12, 2, 4, 6, 1, 0, 1);
55 run(3, 4, 17, 32, 2, 3, 2, 5, 4, 4);
56 run(5, 5, 24, 43, 11, 9, 3, 3, 12, 2);
57 run(2, 3, 20, 33, 3, 5, 7, 4, 15, 2);
58 run(4, 4, 6, 7, 9, 3, 2, 2, 1, 3);
59 }
60}
61
62#if MEGDNN_WITH_BENCHMARK
63TEST_F(AARCH64, BENCHMARK_MATRIX_MUL_QUICK_FP16) {

Callers

nothing calls this directly

Calls 7

profileFunction · 0.85
set_dtypeMethod · 0.80
runFunction · 0.50
paramMethod · 0.45
deduce_layoutMethod · 0.45
execMethod · 0.45
total_nr_elemsMethod · 0.45

Tested by

no test coverage detected