summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrzemysław Dolata <snowball91b@gmail.com>2018-02-02 16:47:46 +0100
committerGitHub <noreply@github.com>2018-02-02 16:47:46 +0100
commitd2627e9565d5fdc1a9bf8c964c762c7dc8ea9a3d (patch)
tree9044f3da05953fb6305575ce28667b4d779d4915
parent88c96189bcbf3853b93e2b65c7b5e4948f9d5f67 (diff)
parentfb0795cd325cee991073b3b02c280e04b62790ba (diff)
downloadcaffe-d2627e9565d5fdc1a9bf8c964c762c7dc8ea9a3d.tar.gz
caffe-d2627e9565d5fdc1a9bf8c964c762c7dc8ea9a3d.tar.bz2
caffe-d2627e9565d5fdc1a9bf8c964c762c7dc8ea9a3d.zip
Merge pull request #5545 from brunobowden/shape_mismatch_checks
Shape mismatch CHECK logging improvements
-rw-r--r--src/caffe/layers/base_conv_layer.cpp4
-rw-r--r--src/caffe/layers/recurrent_layer.cpp5
-rw-r--r--src/caffe/layers/slice_layer.cpp4
3 files changed, 9 insertions, 4 deletions
diff --git a/src/caffe/layers/base_conv_layer.cpp b/src/caffe/layers/base_conv_layer.cpp
index 35c90145..aff0a754 100644
--- a/src/caffe/layers/base_conv_layer.cpp
+++ b/src/caffe/layers/base_conv_layer.cpp
@@ -193,7 +193,9 @@ void BaseConvolutionLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
// TODO: generalize to handle inputs of different shapes.
for (int bottom_id = 1; bottom_id < bottom.size(); ++bottom_id) {
CHECK(bottom[0]->shape() == bottom[bottom_id]->shape())
- << "All inputs must have the same shape.";
+ << "shape mismatch - bottom[0]: " << bottom[0]->shape_string()
+ << " vs. bottom[" << bottom_id << "]: "
+ << bottom[bottom_id]->shape_string();
}
// Shape the tops.
bottom_shape_ = &bottom[0]->shape();
diff --git a/src/caffe/layers/recurrent_layer.cpp b/src/caffe/layers/recurrent_layer.cpp
index e0c82773..9cd3206f 100644
--- a/src/caffe/layers/recurrent_layer.cpp
+++ b/src/caffe/layers/recurrent_layer.cpp
@@ -214,8 +214,9 @@ void RecurrentLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
const int bottom_offset = 2 + static_input_;
for (int i = bottom_offset, j = 0; i < bottom.size(); ++i, ++j) {
CHECK(recur_input_blobs_[j]->shape() == bottom[i]->shape())
- << "bottom[" << i << "] shape must match hidden state input shape: "
- << recur_input_blobs_[j]->shape_string();
+ << "shape mismatch - recur_input_blobs_[" << j << "]: "
+ << recur_input_blobs_[j]->shape_string()
+ << " vs. bottom[" << i << "]: " << bottom[i]->shape_string();
recur_input_blobs_[j]->ShareData(*bottom[i]);
}
}
diff --git a/src/caffe/layers/slice_layer.cpp b/src/caffe/layers/slice_layer.cpp
index 759beafe..64de0964 100644
--- a/src/caffe/layers/slice_layer.cpp
+++ b/src/caffe/layers/slice_layer.cpp
@@ -41,7 +41,9 @@ void SliceLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
int count = 0;
if (slice_point_.size() != 0) {
CHECK_EQ(slice_point_.size(), top.size() - 1);
- CHECK_LE(top.size(), bottom_slice_axis);
+ CHECK_LE(top.size(), bottom_slice_axis)
+ << "slice axis: " << slice_axis_
+ << ", bottom[0] shape: " << bottom[0]->shape_string();
int prev = 0;
vector<int> slices;
for (int i = 0; i < slice_point_.size(); ++i) {