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

Function TEST

test/singa/test_cudnn_convolution.cc:28–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 15

num_filtersMethod · 0.80
bias_termMethod · 0.80
workspace_byte_limitMethod · 0.80
preferMethod · 0.80
ToHostMethod · 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

Tested by

no test coverage detected