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

Method Setup

src/model/layer/activation.cc:38–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36RegisterLayerClass(singacl_tanh, Activation);
37
38void Activation::Setup(const Shape& in_sample, const LayerConf& conf) {
39 Layer::Setup(in_sample, conf);
40 auto pos = conf.type().find_first_of('_');
41 CHECK_NE(pos, string::npos) << "There should be a '_' in the laye type "
42 << conf.type();
43 mode_ = ToLowerCase(conf.type().substr(pos + 1));
44 if (mode_ != "relu" && mode_ != "sigmoid" && mode_ != "tanh")
45 LOG(FATAL) << "Unkown activation type: " << conf.type() << " " << mode_
46 << ". Please use singa_relu, singa_sigmoid, or singa_tanh";
47 if (mode_ == "relu") {
48 neg_slope_ = conf.relu_conf().negative_slope();
49 }
50 out_sample_shape_ = in_sample;
51}
52
53const Tensor Activation::Forward(int flag, const Tensor& input) {
54 Tensor output;

Callers

nothing calls this directly

Calls 3

SetupFunction · 0.85
ToLowerCaseFunction · 0.85
typeMethod · 0.80

Tested by

no test coverage detected