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

Function GenConvConf

examples/cpp/cifar10/vgg-parallel.cc:41–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39const float default_wd = 0.0005f;
40
41LayerConf GenConvConf(string name, int nb_filter, int kernel, int stride,
42 int pad, float std = .02f, float bias = .0f) {
43 LayerConf conf;
44 conf.set_name(name);
45 conf.set_type(engine + "_convolution");
46 ConvolutionConf *conv = conf.mutable_convolution_conf();
47 conv->set_num_output(nb_filter);
48 conv->add_kernel_size(kernel);
49 conv->add_stride(stride);
50 conv->add_pad(pad);
51 conv->set_bias_term(true);
52
53 ParamSpec *wspec = conf.add_param();
54 wspec->set_name(name + "_weight");
55 auto wfill = wspec->mutable_filler();
56 wfill->set_type("Gaussian");
57 wfill->set_std(sqrt(2.0f/(nb_filter*9.0f)));
58
59 ParamSpec *bspec = conf.add_param();
60 bspec->set_name(name + "_bias");
61 auto bfill = bspec->mutable_filler();
62 bfill->set_value(bias);
63 // bspec->set_lr_mult(2);
64 // bspec->set_decay_mult(0);
65 return conf;
66}
67
68LayerConf GenPoolingConf(string name, bool max_pool, int kernel, int stride,
69 int pad) {

Callers 1

ConvBNReLUFunction · 0.70

Calls 2

sqrtFunction · 0.50
set_valueMethod · 0.45

Tested by

no test coverage detected