| 36 | RegisterLayerClass(singacl_tanh, Activation); |
| 37 | |
| 38 | void 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 | |
| 53 | const Tensor Activation::Forward(int flag, const Tensor& input) { |
| 54 | Tensor output; |
nothing calls this directly
no test coverage detected