add necessary input checks for matcaffe
Merge pull request #888 from ronghanghu/matcaffe-add-check

add necessary input checks for matcaffe