use DCHECK in SoftmaxLossLayer so that bounds checking has no perf penalty without...
authorJonathan L Long <jonlong@cs.berkeley.edu>
Mon, 24 Nov 2014 01:58:24 +0000 (17:58 -0800)
committerJonathan L Long <jonlong@cs.berkeley.edu>
Mon, 24 Nov 2014 01:58:24 +0000 (17:58 -0800)
src/caffe/layers/softmax_loss_layer.cpp

index c435873..82c62f6 100644 (file)
@@ -44,8 +44,8 @@ void SoftmaxWithLossLayer<Dtype>::Forward_cpu(
   for (int i = 0; i < num; ++i) {
     for (int j = 0; j < spatial_dim; j++) {
       const int label_value = static_cast<int>(label[i * spatial_dim + j]);
-      CHECK_GE(label_value, 0);
-      CHECK_GT(dim, label_value * spatial_dim);
+      DCHECK_GE(label_value, 0);
+      DCHECK_GT(dim, label_value * spatial_dim);
       loss -= log(std::max(prob_data[i * dim +
           label_value * spatial_dim + j],
                            Dtype(FLT_MIN)));