singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [singa] Wentong-DST commented on a change in pull request #552: SINGA-496 Implement softplus and softsign functions for tensor math
Date Mon, 25 Nov 2019 17:36:56 GMT
Wentong-DST 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_r350325886
 
 

 ##########
 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:
   Thanks @chrishkchris for pointing out the problem that has puzzled me since the second
last commit! I thought they were identical but somehow it didn't passed tests.
   I'll close the conversation if there's no other problem found.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message