GitHub PullRequestReviewCommentEvent at 2014-07-15 20:58:46
Repository: caffe
Actor: rbgirshick
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/BVLC/caffe/pulls/comments/14962850","id":14962850,"diff_hunk":"@@ -4,16 +4,66 @@\n // caffe::Caffe functions so that one could easily call it from matlab.\n // Note that for matlab, we will simply use float as the data type.\n \n-#include <string>\n-#include <vector>\n+// these need to be included after boost on OS X\n+#include <string>  // NOLINT(build/include_order)\n+#include <vector>  // NOLINT(build/include_order)\n+#include <fstream>  // NOLINT\n+#include <stdexcept>\n \n #include \"mex.h\"\n #include \"caffe/caffe.hpp\"\n \n #define MEX_ARGS int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs\n \n+// The interim macro that simply strips the excess and ends up with the required macro\n+#define CHECK_EQ_X(A,B,C,FUNC, ...) FUNC\n+\n+// The macro that the programmer uses\n+#define CHECK_EQ(...)  CHECK_EQ_X(__VA_ARGS__,  \\\n+                       CHECK_EQ_3(__VA_ARGS__),    \\\n+                       CHECK_EQ_2(__VA_ARGS__))\n+\n+#define CHECK_EQ_2(a, b)  do {                                  \\\n+  if ( (a) != (b) ) {                                           \\\n+    fprintf(stderr, \"%s:%d: Check failed because %s != %s\\n\",   \\\n+            __FILE__, __LINE__, #a, #b);                        \\\n+    mexErrMsgTxt(\"Error in CHECK_EQ\");                          \\\n+  }                                                             \\\n+} while (0);\n+\n+#define CHECK_EQ_3(a, b, m)  do {                               \\\n+  if ( (a) != (b) ) {                                           \\\n+    fprintf(stderr, \"%s:%d: Check failed because %s != %s\\n\",   \\\n+            __FILE__, __LINE__, #a, #b);                        \\\n+    fprintf(stderr, \"%s:%d: %s\\n\",                              \\\n+            __FILE__, __LINE__, #m);                            \\\n+    mexErrMsgTxt(#m);                                           \\\n+  }                                                             \\\n+} while (0);\n+\n+#define CUDA_CHECK(condition) \\\n+  /* Code block avoids redefinition of cudaError_t error */ \\\n+  do { \\\n+    cudaError_t error = condition; \\\n+    CHECK_EQ(error, cudaSuccess, \"CUDA_CHECK\")  \\\n+  } while (0)\n+\n using namespace caffe;  // NOLINT(build/namespaces)\n \n+\n+// for convenience, check that input files can be opened, and raise an","path":"matlab/caffe/matcaffe.cpp","position":53,"original_position":53,"commit_id":"db1a9901f39927e81ca342113db21111093b00ca","original_commit_id":"db1a9901f39927e81ca342113db21111093b00ca","user":{"login":"rbgirshick","id":1190634,"avatar_url":"https://avatars.githubusercontent.com/u/1190634?","gravatar_id":"9695beb63f88952064936c7345d09ee2","url":"https://api.github.com/users/rbgirshick","html_url":"https://github.com/rbgirshick","followers_url":"https://api.github.com/users/rbgirshick/followers","following_url":"https://api.github.com/users/rbgirshick/following{/other_user}","gists_url":"https://api.github.com/users/rbgirshick/gists{/gist_id}","starred_url":"https://api.github.com/users/rbgirshick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbgirshick/subscriptions","organizations_url":"https://api.github.com/users/rbgirshick/orgs","repos_url":"https://api.github.com/users/rbgirshick/repos","events_url":"https://api.github.com/users/rbgirshick/events{/privacy}","received_events_url":"https://api.github.com/users/rbgirshick/received_events","type":"User","site_admin":false},"body":"This comment looks like it was copied over from the python wrapper.","created_at":"2014-07-15T20:58:46Z","updated_at":"2014-07-15T20:58:46Z","html_url":"https://github.com/BVLC/caffe/pull/501#discussion_r14962850","pull_request_url":"https://api.github.com/repos/BVLC/caffe/pulls/501","_links":{"self":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/comments/14962850"},"html":{"href":"https://github.com/BVLC/caffe/pull/501#discussion_r14962850"},"pull_request":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/501"}}},"pull_request":{"url":"https://api.github.com/repos/BVLC/caffe/pulls/501","id":17139575,"html_url":"https://github.com/BVLC/caffe/pull/501","diff_url":"https://github.com/BVLC/caffe/pull/501.diff","patch_url":"https://github.com/BVLC/caffe/pull/501.patch","issue_url":"https://api.github.com/repos/BVLC/caffe/issues/501","number":501,"state":"open","title":"Matcaffe2","user":{"login":"sguada","id":1766524,"avatar_url":"https://avatars.githubusercontent.com/u/1766524?","gravatar_id":"a7d70183dd655115f36ec43654711db0","url":"https://api.github.com/users/sguada","html_url":"https://github.com/sguada","followers_url":"https://api.github.com/users/sguada/followers","following_url":"https://api.github.com/users/sguada/following{/other_user}","gists_url":"https://api.github.com/users/sguada/gists{/gist_id}","starred_url":"https://api.github.com/users/sguada/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sguada/subscriptions","organizations_url":"https://api.github.com/users/sguada/orgs","repos_url":"https://api.github.com/users/sguada/repos","events_url":"https://api.github.com/users/sguada/events{/privacy}","received_events_url":"https://api.github.com/users/sguada/received_events","type":"User","site_admin":false},"body":"Inspired by PyCaffe, a new and completely renovated MatCaffe interface (although backward compatible).\r\n\r\nNow there is class CaffeNet that handle all the interactions with caffe. \r\n\r\nNew Features:\r\n- `net = CaffeNet.instance` gets a instance of caffe network using default imagenet_deploy and caffe_reference_model\r\n- `net = CaffeNet.instance(model_def_file, model_file)` gets an instance of caffe network using the parameters specified.\r\n```\r\nnet = \r\n  CaffeNet with properties:\r\n\r\n    model_def_file: '../../examples/imagenet/imagenet_deploy.prototxt'\r\n        model_file: '../../examples/imagenet/caffe_reference_imagenet_model'\r\n       layers_info: [23x1 struct]\r\n        blobs_info: [15x1 struct]\r\n              mode: 'CPU'\r\n             phase: 'TRAIN'\r\n         device_id: 0\r\n       input_blobs: []\r\n      output_blobs: []\r\n           weights: [8x1 struct]\r\n```\r\n- Now one can set mode, phase or device_id, just by assigning the properties or using the corresponding methods.\r\n``` net.phase = 'TEST'; net.set_phase_test; net.set_phase('TEST');```\r\n```net.mode = 'GPU'; net.set_mode_gpu; net_set_mode('GPU');```\r\n```net.device_id = 1;net.set_device(1); ```\r\n\r\n- One can access the weights of the network just by \r\n```\r\nnet.weights   \r\n8x1 struct array with fields:\r\n\r\n    layer_name\r\n    weights\r\n```\r\n-  More amazingly can change the weights of the network by just assigning a new set of weights, for example changing the bias of the first layer `conv1`.\r\n```\r\nnew_weights = net.weights;\r\nnew_weights(1)                    \r\n    layer_name: 'conv1'\r\n       weights: {2x1 cell}\r\nnew_weights(1).weights{2}(:) = 0; \r\nnet.weights = new_weights;\r\n```\r\n- Then one can save the new network in a different model_file\r\n```\r\nnet.save_net('path_to/new_model')\r\n```\r\n\r\n- And load it later\r\n```\r\nnet.load_net('path_to/new_model')\r\n```\r\n\r\nMore examples about new features to follow.","created_at":"2014-06-14T02:49:23Z","updated_at":"2014-07-15T20:58:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f4cc9663be5ff70a42c2f1fde488a8dcc768d775","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/BVLC/caffe/pulls/501/commits","review_comments_url":"https://api.github.com/repos/BVLC/caffe/pulls/501/comments","review_comment_url":"https://api.github.com/repos/BVLC/caffe/pulls/comments/{number}","comments_url":"https://api.github.com/repos/BVLC/caffe/issues/501/comments","statuses_url":"https://api.github.com/repos/BVLC/caffe/statuses/db1a9901f39927e81ca342113db21111093b00ca","head":{"label":"sguada:matcaffe2","ref":"matcaffe2","sha":"db1a9901f39927e81ca342113db21111093b00ca","user":{"login":"sguada","id":1766524,"avatar_url":"https://avatars.githubusercontent.com/u/1766524?","gravatar_id":"a7d70183dd655115f36ec43654711db0","url":"https://api.github.com/users/sguada","html_url":"https://github.com/sguada","followers_url":"https://api.github.com/users/sguada/followers","following_url":"https://api.github.com/users/sguada/following{/other_user}","gists_url":"https://api.github.com/users/sguada/gists{/gist_id}","starred_url":"https://api.github.com/users/sguada/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sguada/subscriptions","organizations_url":"https://api.github.com/users/sguada/orgs","repos_url":"https://api.github.com/users/sguada/repos","events_url":"https://api.github.com/users/sguada/events{/privacy}","received_events_url":"https://api.github.com/users/sguada/received_events","type":"User","site_admin":false},"repo":{"id":17845322,"name":"caffe-public","full_name":"sguada/caffe-public","owner":{"login":"sguada","id":1766524,"avatar_url":"https://avatars.githubusercontent.com/u/1766524?","gravatar_id":"a7d70183dd655115f36ec43654711db0","url":"https://api.github.com/users/sguada","html_url":"https://github.com/sguada","followers_url":"https://api.github.com/users/sguada/followers","following_url":"https://api.github.com/users/sguada/following{/other_user}","gists_url":"https://api.github.com/users/sguada/gists{/gist_id}","starred_url":"https://api.github.com/users/sguada/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sguada/subscriptions","organizations_url":"https://api.github.com/users/sguada/orgs","repos_url":"https://api.github.com/users/sguada/repos","events_url":"https://api.github.com/users/sguada/events{/privacy}","received_events_url":"https://api.github.com/users/sguada/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sguada/caffe-public","description":"Caffe","fork":true,"url":"https://api.github.com/repos/sguada/caffe-public","forks_url":"https://api.github.com/repos/sguada/caffe-public/forks","keys_url":"https://api.github.com/repos/sguada/caffe-public/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sguada/caffe-public/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sguada/caffe-public/teams","hooks_url":"https://api.github.com/repos/sguada/caffe-public/hooks","issue_events_url":"https://api.github.com/repos/sguada/caffe-public/issues/events{/number}","events_url":"https://api.github.com/repos/sguada/caffe-public/events","assignees_url":"https://api.github.com/repos/sguada/caffe-public/assignees{/user}","branches_url":"https://api.github.com/repos/sguada/caffe-public/branches{/branch}","tags_url":"https://api.github.com/repos/sguada/caffe-public/tags","blobs_url":"https://api.github.com/repos/sguada/caffe-public/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sguada/caffe-public/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sguada/caffe-public/git/refs{/sha}","trees_url":"https://api.github.com/repos/sguada/caffe-public/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sguada/caffe-public/statuses/{sha}","languages_url":"https://api.github.com/repos/sguada/caffe-public/languages","stargazers_url":"https://api.github.com/repos/sguada/caffe-public/stargazers","contributors_url":"https://api.github.com/repos/sguada/caffe-public/contributors","subscribers_url":"https://api.github.com/repos/sguada/caffe-public/subscribers","subscription_url":"https://api.github.com/repos/sguada/caffe-public/subscription","commits_url":"https://api.github.com/repos/sguada/caffe-public/commits{/sha}","git_commits_url":"https://api.github.com/repos/sguada/caffe-public/git/commits{/sha}","comments_url":"https://api.github.com/repos/sguada/caffe-public/comments{/number}","issue_comment_url":"https://api.github.com/repos/sguada/caffe-public/issues/comments/{number}","contents_url":"https://api.github.com/repos/sguada/caffe-public/contents/{+path}","compare_url":"https://api.github.com/repos/sguada/caffe-public/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sguada/caffe-public/merges","archive_url":"https://api.github.com/repos/sguada/caffe-public/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sguada/caffe-public/downloads","issues_url":"https://api.github.com/repos/sguada/caffe-public/issues{/number}","pulls_url":"https://api.github.com/repos/sguada/caffe-public/pulls{/number}","milestones_url":"https://api.github.com/repos/sguada/caffe-public/milestones{/number}","notifications_url":"https://api.github.com/repos/sguada/caffe-public/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sguada/caffe-public/labels{/name}","releases_url":"https://api.github.com/repos/sguada/caffe-public/releases{/id}","created_at":"2014-03-17T22:16:55Z","updated_at":"2014-06-26T10:02:47Z","pushed_at":"2014-07-07T18:45:57Z","git_url":"git://github.com/sguada/caffe-public.git","ssh_url":"git@github.com:sguada/caffe-public.git","clone_url":"https://github.com/sguada/caffe-public.git","svn_url":"https://github.com/sguada/caffe-public","homepage":"http://caffe.berkeleyvision.org/","size":21024,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"BVLC:dev","ref":"dev","sha":"3d0bc1acbd98de289f038fd836dbab27ffadb4cc","user":{"login":"BVLC","id":6182163,"avatar_url":"https://avatars.githubusercontent.com/u/6182163?","gravatar_id":"36c099c330b6dcee08afd38b6c3168f4","url":"https://api.github.com/users/BVLC","html_url":"https://github.com/BVLC","followers_url":"https://api.github.com/users/BVLC/followers","following_url":"https://api.github.com/users/BVLC/following{/other_user}","gists_url":"https://api.github.com/users/BVLC/gists{/gist_id}","starred_url":"https://api.github.com/users/BVLC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BVLC/subscriptions","organizations_url":"https://api.github.com/users/BVLC/orgs","repos_url":"https://api.github.com/users/BVLC/repos","events_url":"https://api.github.com/users/BVLC/events{/privacy}","received_events_url":"https://api.github.com/users/BVLC/received_events","type":"Organization","site_admin":false},"repo":{"id":12791642,"name":"caffe","full_name":"BVLC/caffe","owner":{"login":"BVLC","id":6182163,"avatar_url":"https://avatars.githubusercontent.com/u/6182163?","gravatar_id":"36c099c330b6dcee08afd38b6c3168f4","url":"https://api.github.com/users/BVLC","html_url":"https://github.com/BVLC","followers_url":"https://api.github.com/users/BVLC/followers","following_url":"https://api.github.com/users/BVLC/following{/other_user}","gists_url":"https://api.github.com/users/BVLC/gists{/gist_id}","starred_url":"https://api.github.com/users/BVLC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BVLC/subscriptions","organizations_url":"https://api.github.com/users/BVLC/orgs","repos_url":"https://api.github.com/users/BVLC/repos","events_url":"https://api.github.com/users/BVLC/events{/privacy}","received_events_url":"https://api.github.com/users/BVLC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BVLC/caffe","description":"Caffe: a Fast framework for neural networks. For the most recent version, check out branch dev. For a more stable version, check out branch master.","fork":false,"url":"https://api.github.com/repos/BVLC/caffe","forks_url":"https://api.github.com/repos/BVLC/caffe/forks","keys_url":"https://api.github.com/repos/BVLC/caffe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BVLC/caffe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BVLC/caffe/teams","hooks_url":"https://api.github.com/repos/BVLC/caffe/hooks","issue_events_url":"https://api.github.com/repos/BVLC/caffe/issues/events{/number}","events_url":"https://api.github.com/repos/BVLC/caffe/events","assignees_url":"https://api.github.com/repos/BVLC/caffe/assignees{/user}","branches_url":"https://api.github.com/repos/BVLC/caffe/branches{/branch}","tags_url":"https://api.github.com/repos/BVLC/caffe/tags","blobs_url":"https://api.github.com/repos/BVLC/caffe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BVLC/caffe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BVLC/caffe/git/refs{/sha}","trees_url":"https://api.github.com/repos/BVLC/caffe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BVLC/caffe/statuses/{sha}","languages_url":"https://api.github.com/repos/BVLC/caffe/languages","stargazers_url":"https://api.github.com/repos/BVLC/caffe/stargazers","contributors_url":"https://api.github.com/repos/BVLC/caffe/contributors","subscribers_url":"https://api.github.com/repos/BVLC/caffe/subscribers","subscription_url":"https://api.github.com/repos/BVLC/caffe/subscription","commits_url":"https://api.github.com/repos/BVLC/caffe/commits{/sha}","git_commits_url":"https://api.github.com/repos/BVLC/caffe/git/commits{/sha}","comments_url":"https://api.github.com/repos/BVLC/caffe/comments{/number}","issue_comment_url":"https://api.github.com/repos/BVLC/caffe/issues/comments/{number}","contents_url":"https://api.github.com/repos/BVLC/caffe/contents/{+path}","compare_url":"https://api.github.com/repos/BVLC/caffe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BVLC/caffe/merges","archive_url":"https://api.github.com/repos/BVLC/caffe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BVLC/caffe/downloads","issues_url":"https://api.github.com/repos/BVLC/caffe/issues{/number}","pulls_url":"https://api.github.com/repos/BVLC/caffe/pulls{/number}","milestones_url":"https://api.github.com/repos/BVLC/caffe/milestones{/number}","notifications_url":"https://api.github.com/repos/BVLC/caffe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BVLC/caffe/labels{/name}","releases_url":"https://api.github.com/repos/BVLC/caffe/releases{/id}","created_at":"2013-09-12T18:39:48Z","updated_at":"2014-07-15T18:41:34Z","pushed_at":"2014-07-15T20:47:45Z","git_url":"git://github.com/BVLC/caffe.git","ssh_url":"git@github.com:BVLC/caffe.git","clone_url":"https://github.com/BVLC/caffe.git","svn_url":"https://github.com/BVLC/caffe","homepage":"http://caffe.berkeleyvision.org/","size":35078,"stargazers_count":618,"watchers_count":618,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":340,"mirror_url":null,"open_issues_count":158,"forks":340,"open_issues":158,"watchers":618,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/501"},"html":{"href":"https://github.com/BVLC/caffe/pull/501"},"issue":{"href":"https://api.github.com/repos/BVLC/caffe/issues/501"},"comments":{"href":"https://api.github.com/repos/BVLC/caffe/issues/501/comments"},"review_comments":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/501/comments"},"review_comment":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/501/commits"},"statuses":{"href":"https://api.github.com/repos/BVLC/caffe/statuses/db1a9901f39927e81ca342113db21111093b00ca"}}}}