MCPcopy Create free account
hub / github.com/apache/singa / TEST

Function TEST

test/singa/test_convolution.cc:29–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27using singa::Convolution;
28using singa::Shape;
29TEST(Convolution, Setup) {
30 Convolution conv;
31 // EXPECT_EQ("Convolution", conv.layer_type());
32
33 singa::LayerConf conf;
34 singa::ConvolutionConf *convconf = conf.mutable_convolution_conf();
35 convconf->set_kernel_h(2);
36 convconf->set_kernel_w(2);
37 convconf->set_pad_h(1);
38 convconf->set_pad_w(1);
39 convconf->set_stride_h(1);
40 convconf->set_stride_w(1);
41 convconf->set_num_output(2);
42 convconf->set_bias_term(true);
43 conv.Setup(Shape{1, 3, 3}, conf);
44
45 EXPECT_EQ(2u, conv.kernel_h());
46 EXPECT_EQ(2u, conv.kernel_w());
47 EXPECT_EQ(1u, conv.pad_h());
48 EXPECT_EQ(1u, conv.pad_w());
49 EXPECT_EQ(1u, conv.stride_h());
50 EXPECT_EQ(1u, conv.stride_w());
51 EXPECT_EQ(2u, conv.num_filters());
52 EXPECT_EQ(true, conv.bias_term());
53 EXPECT_EQ(1u, conv.channels());
54 EXPECT_EQ(3u, conv.height());
55 EXPECT_EQ(3u, conv.width());
56}
57
58TEST(Convolution, Forward) {
59 const size_t batchsize = 2, c = 1, h = 3, w = 3;

Callers

nothing calls this directly

Calls 15

num_filtersMethod · 0.80
bias_termMethod · 0.80
SetupMethod · 0.45
kernel_hMethod · 0.45
kernel_wMethod · 0.45
pad_hMethod · 0.45
pad_wMethod · 0.45
stride_hMethod · 0.45
stride_wMethod · 0.45
channelsMethod · 0.45
heightMethod · 0.45
widthMethod · 0.45

Tested by

no test coverage detected