chrishkchris commented on a change in pull request #552: SINGA-496 Implement
softplus and softsign functions for tensor math
URL: https://github.com/apache/singa/pull/552#discussion_r348291980
##########
File path: test/singa/test_tensor_math.cc
##########
@@ -120,6 +120,32 @@ TEST_F(TensorMath, SignCpp) {
EXPECT_EQ(1.0f, dptr1[2]);
}
+TEST_F(TensorMath, SoftPlusCpp) {
+ Tensor aa = a.Clone();
+ Tensor cc = aa - 1.0f;
+ const float *dptr = cc.data<float>();
+ EXPECT_NEAR(0.0f, dptr[0], 1e-5);
+ EXPECT_NEAR(1.0f, dptr[1], 1e-5);
+
+ Tensor p = SoftPlus(cc);
+ const float *dptr1 = p.data<float>();
+ EXPECT_EQ(log(2.0f), dptr1[0]);
+ EXPECT_EQ(log(exp(1) + 1.0f), dptr1[1]);
+}
Review comment:
@Wentong-DST
Concerning the above comment, I have just submitted a pull request to your
repo to change EXPECT_EQ to EXPECT_NEAR
The pull request is at: https://github.com/Wentong-DST/incubator-singa/pull/1
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services