diff options
author | Ross Girshick <rbg@eecs.berkeley.edu> | 2014-01-13 13:34:34 -0800 |
---|---|---|
committer | Evan Shelhamer <shelhamer@imaginarynumber.net> | 2014-03-19 19:12:57 -0700 |
commit | 9c7a993947d4401db382a1729088b8c66817e170 (patch) | |
tree | e4d108ec21a17e6c76160d8286b5f0f6c7743118 /matlab | |
parent | ba10066aff51f935f50ddba904ea34046433a79d (diff) | |
download | caffe-9c7a993947d4401db382a1729088b8c66817e170.tar.gz caffe-9c7a993947d4401db382a1729088b8c66817e170.tar.bz2 caffe-9c7a993947d4401db382a1729088b8c66817e170.zip |
add initialization key for verifying state
Diffstat (limited to 'matlab')
-rw-r--r-- | matlab/caffe/matcaffe.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/matlab/caffe/matcaffe.cpp b/matlab/caffe/matcaffe.cpp index 99ef3f4b..524393a9 100644 --- a/matlab/caffe/matcaffe.cpp +++ b/matlab/caffe/matcaffe.cpp @@ -16,6 +16,7 @@ using namespace caffe; // NOLINT(build/namespaces) // The pointer to the internal caffe::Net instance static shared_ptr<Net<float> > net_; +static int init_key = -2; // Five things to be aware of: // caffe uses row-major order @@ -199,6 +200,10 @@ static void set_device(MEX_ARGS) { Caffe::SetDevice(device_id); } +static void get_init_key(MEX_ARGS) { + plhs[0] = mxCreateDoubleScalar(init_key); +} + static void init(MEX_ARGS) { if (nrhs != 2) { LOG(ERROR) << "Only given " << nrhs << " arguments"; @@ -213,6 +218,11 @@ static void init(MEX_ARGS) { mxFree(param_file); mxFree(model_file); + + init_key = rand(); + if (nlhs == 1) { + plhs[0] = mxCreateDoubleScalar(init_key); + } } static void forward(MEX_ARGS) { @@ -251,6 +261,7 @@ static handler_registry handlers[] = { { "set_phase_test", set_phase_test }, { "set_device", set_device }, { "get_weights", get_weights }, + { "get_init_key", get_init_key }, // The end. { "END", NULL }, }; |