| 27 | using singa::Activation; |
| 28 | using singa::Shape; |
| 29 | TEST(Activation, Setup) { |
| 30 | Activation acti; |
| 31 | // EXPECT_EQ("Activation", acti.layer_type()); |
| 32 | |
| 33 | singa::LayerConf conf; |
| 34 | conf.set_type("singa_relu"); |
| 35 | singa::ReLUConf* reluconf = conf.mutable_relu_conf(); |
| 36 | reluconf->set_negative_slope(0.5); |
| 37 | |
| 38 | acti.Setup(Shape{3}, conf); |
| 39 | EXPECT_EQ("relu", acti.Mode()); |
| 40 | EXPECT_EQ(0.5f, acti.Negative_slope()); |
| 41 | } |
| 42 | |
| 43 | TEST(Activation, Forward) { |
| 44 | const float x[] = {1.0f, 2.0f, 3.0f, -2.0f, -3.0f, -4.0}; |