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

Function TEST_F

dnn/test/fallback/conv_bias.cpp:17–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15namespace test {
16
17TEST_F(FALLBACK, CONV_BIAS_FORWARD) {
18 using namespace conv_bias;
19 std::vector<TestArg> args = get_args();
20 Checker<ConvBiasForward> checker(handle());
21 NormalRNG default_rng;
22 UniformIntRNG int_rng{-50, 50};
23 param::ConvBias param;
24 {
25 param.format = param::ConvBias::Format::NHWC;
26 auto src_shape = TensorShape{2, 16, 32, 24};
27 auto filter_shape = TensorShape{4, 3, 3, 24};
28 auto bias_shape_channel = TensorShape{1, 1, 1, 4};
29 checker.set_dtype(0, dtype::Float32())
30 .set_dtype(1, dtype::Float32())
31 .set_dtype(2, dtype::Float32())
32 .set_rng(0, &default_rng)
33 .set_rng(1, &default_rng)
34 .set_rng(2, &default_rng)
35 .set_param(param)
36 .execs({src_shape, filter_shape, bias_shape_channel, {}, {}});
37 }
38 checker.set_before_exec_callback(
39 conv_bias::ConvBiasAlgoChecker<ConvBias>("FALLBACK_NAIVE"));
40 for (auto&& arg : args) {
41 checker.set_dtype(0, dtype::Float32())
42 .set_dtype(1, dtype::Float32())
43 .set_dtype(2, dtype::Float32())
44 .set_rng(0, &default_rng)
45 .set_rng(1, &default_rng)
46 .set_rng(2, &default_rng)
47 .set_epsilon(1e-3)
48 .set_param(arg.param)
49 .execs({arg.src, arg.filter, arg.bias, {}, {}});
50 }
51 {
52 param.format = param::ConvBias::Format::NCHW;
53 param.sparse = ConvBias::Param::Sparse::GROUP;
54 auto src_shape = TensorShape{2, 16, 32, 24};
55 auto filter_shape = TensorShape{4, 4, 4, 1, 1};
56 auto bias_shape_channel = TensorShape{1, 16, 1, 1};
57 auto bias_shape = TensorShape{2, 16, 32, 24};
58 checker.set_dtype(0, dtype::Float32())
59 .set_dtype(1, dtype::Float32())
60 .set_dtype(2, dtype::Float32())
61 .set_rng(0, &default_rng)
62 .set_rng(1, &default_rng)
63 .set_rng(2, &default_rng)
64 .set_param(param)
65 .execs({src_shape, filter_shape, bias_shape, {}, {}})
66 .execs({src_shape, filter_shape, bias_shape_channel, {}, {}});
67 }
68}
69
70TEST_F(FALLBACK, CONV_BIAS_FORWARD_RECORD) {
71 using namespace conv_bias;

Callers

nothing calls this directly

Calls 15

check_conv_biasFunction · 0.85
check_winogradFunction · 0.85
get_winograd_argsFunction · 0.85
benchmark_with_contrastFunction · 0.85
set_dtypeMethod · 0.80
emplace_backMethod · 0.80
get_conv_bias_argsFunction · 0.70
checker_conv_biasFunction · 0.70

Tested by

no test coverage detected