Corrected conditions in test_threshold
authorSergio Guadarrama <sguada@gmail.com>
Fri, 16 May 2014 01:58:04 +0000 (18:58 -0700)
committerSergio <sguada@gmail.com>
Tue, 27 May 2014 17:32:23 +0000 (10:32 -0700)
src/caffe/test/test_threshold_layer.cpp

index 25e9f02..4f87d0d 100644 (file)
@@ -64,8 +64,12 @@ TYPED_TEST(ThresholdLayerTest, TestCPU) {
   for (int i = 0; i < this->blob_bottom_->count(); ++i) {
     EXPECT_GE(top_data[i], 0.);
     EXPECT_LE(top_data[i], 1.);
-    EXPECT_TRUE(top_data[i] == 0 && bottom_data[i] <= threshold_);
-    EXPECT_TRUE(top_data[i] == 1 && bottom_data[i] > threshold_);
+    if (top_data[i] == 0) {
+       EXPECT_LE(bottom_data[i],threshold_);
+    }
+    if (top_data[i] == 1) {
+       EXPECT_GT(bottom_data[i],threshold_);
+    }
   }
 }
 
@@ -86,8 +90,12 @@ TYPED_TEST(ThresholdLayerTest, TestCPU2) {
   for (int i = 0; i < this->blob_bottom_->count(); ++i) {
     EXPECT_GE(top_data[i], 0.);
     EXPECT_LE(top_data[i], 1.);
-    EXPECT_TRUE(top_data[i] == 0 && bottom_data[i] <= threshold_);
-    EXPECT_TRUE(top_data[i] == 1 && bottom_data[i] > threshold_);
+    if (top_data[i] == 0) {
+       EXPECT_LE(bottom_data[i],threshold_);
+    }
+    if (top_data[i] == 1) {
+       EXPECT_TRUE(bottom_data[i] > threshold_); 
+    }
   }
 }