Skip to content

Commit

Permalink
use DCHECK in SoftmaxLossLayer so that bounds checking has no perf pe…
Browse files Browse the repository at this point in the history
…nalty without DEBUG
  • Loading branch information
longjon committed Nov 24, 2014
1 parent 9443c44 commit 33eb36e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/caffe/layers/softmax_loss_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down

0 comments on commit 33eb36e

Please sign in to comment.