Matcaffe num inputs

Two things:
* Prevent Matlab from crashing on matcaffe error by using `mex_error` function instead of `CHECK()` and `LOG(FATAL)`
* Add matcaffe command `get_num_inputs` to get number of model inputs