+
+ if (reshape) {
+ blob->Reshape(blob_dims);
+ } else {
+ if (blob_dims != blob->shape()) {
+ // create shape string for error message
+ ostringstream stream;
+ int count = 1;
+ for (int i = 0; i < blob_dims.size(); ++i) {
+ stream << blob_dims[i] << " ";
+ count = count * blob_dims[i];
+ }
+ stream << "(" << count << ")";
+ string source_shape_string = stream.str();
+
+ CHECK(blob_dims == blob->shape()) << "Cannot load blob from hdf5; shape "
+ << "mismatch. Source shape is " << source_shape_string
+ << " target shape is " << blob->shape_string();
+ }
+ }