From ac8a03d297265efd33a73bfd95f16913ea7b3099 Mon Sep 17 00:00:00 2001 From: Jeff Donahue Date: Wed, 1 Oct 2014 14:19:30 -0700 Subject: [PATCH] [fix] solver indexing of output blobs was incorrect for non-singleton outputs --- src/caffe/solver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/caffe/solver.cpp b/src/caffe/solver.cpp index 0ea4edcf9b8..8d187ea638b 100644 --- a/src/caffe/solver.cpp +++ b/src/caffe/solver.cpp @@ -285,10 +285,10 @@ void Solver::Test(const int test_net_id) { LOG(INFO) << "Test loss: " << loss; } for (int i = 0; i < test_score.size(); ++i) { - const string& output_name = test_net->blob_names()[ - test_net->output_blob_indices()[test_score_output_id[i]]]; - const Dtype loss_weight = - test_net->blob_loss_weights()[test_net->output_blob_indices()[i]]; + const int output_blob_index = + test_net->output_blob_indices()[test_score_output_id[i]]; + const string& output_name = test_net->blob_names()[output_blob_index]; + const Dtype loss_weight = test_net->blob_loss_weights()[output_blob_index]; ostringstream loss_msg_stream; const Dtype mean_score = test_score[i] / param_.test_iter(test_net_id); if (loss_weight) {