Skip to content

Commit 5e1603f

Browse files
jeffdonahuefxbit
authored andcommitted
Merge pull request BVLC#4559 from fyu/loss_reshape
Fix Label Shape Check in LossLayer::Reshape
2 parents 2f35480 + 3616595 commit 5e1603f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/caffe/layers/loss_layer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ void LossLayer<Dtype>::LayerSetUp(
1616
template <typename Dtype>
1717
void LossLayer<Dtype>::Reshape(
1818
const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) {
19-
CHECK_EQ(bottom[0]->num(), bottom[1]->num())
20-
<< "The data and label should have the same number.";
19+
CHECK_EQ(bottom[0]->shape(0), bottom[1]->shape(0))
20+
<< "The data and label should have the same first dimension.";
2121
vector<int> loss_shape(0); // Loss layers output a scalar; 0 axes.
2222
top[0]->Reshape(loss_shape);
2323
}

0 commit comments

Comments
 (0)