summaryrefslogtreecommitdiff
path: root/matlab
diff options
context:
space:
mode:
authorRonghang Hu <huronghang@hotmail.com>2014-08-08 15:47:23 -0700
committerRonghang Hu <huronghang@hotmail.com>2014-08-08 15:47:23 -0700
commitc8b6457de5b9ba194c5539c81a05591bca6b3e1b (patch)
tree3257f92b47bfeb9fdbb49881ab54fdba25ca6fc2 /matlab
parentd82a1ea6bc642be4dd65ffdccea3287ef3800b27 (diff)
downloadcaffeonacl-c8b6457de5b9ba194c5539c81a05591bca6b3e1b.tar.gz
caffeonacl-c8b6457de5b9ba194c5539c81a05591bca6b3e1b.tar.bz2
caffeonacl-c8b6457de5b9ba194c5539c81a05591bca6b3e1b.zip
add necessary input checks for matcaffe
Diffstat (limited to 'matlab')
-rw-r--r--matlab/caffe/matcaffe.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/matlab/caffe/matcaffe.cpp b/matlab/caffe/matcaffe.cpp
index 957ebea0..f4a2425c 100644
--- a/matlab/caffe/matcaffe.cpp
+++ b/matlab/caffe/matcaffe.cpp
@@ -50,6 +50,10 @@ static mxArray* do_forward(const mxArray* const bottom) {
input_blobs.size());
for (unsigned int i = 0; i < input_blobs.size(); ++i) {
const mxArray* const elem = mxGetCell(bottom, i);
+ CHECK(mxIsSingle(elem))
+ << "MatCaffe require single-precision float point data";
+ CHECK_EQ(mxGetNumberOfElements(elem), input_blobs[i]->count())
+ << "MatCaffe input size does not match the input size of the network";
const float* const data_ptr =
reinterpret_cast<const float* const>(mxGetPr(elem));
switch (Caffe::mode()) {