{"action":"created","comment":{"url":"https://api.github.com/repos/BVLC/caffe/pulls/comments/59991656","id":59991656,"diff_hunk":"@@ -6,166 +6,205 @@\n \n namespace caffe {\n \n+// multicast x[c] into y[.,c,...]\n+template <typename Dtype>\n+void BatchNormLayer<Dtype>::multicast_gpu(int N, int C, int S,\n+    const Dtype *x, Dtype *y ) {\n+  Blob<Dtype> temp_NC;\n+  vector<int> temp_size;\n+  temp_size.push_back(N*C);\n+  temp_NC.Reshape(temp_size);\n+  caffe_gpu_gemm<Dtype>(CblasNoTrans, CblasNoTrans, N, C, 1,\n+      1., ones_N_.gpu_data(), x, 0., temp_NC.mutable_gpu_data());\n+  caffe_gpu_gemm<Dtype>(CblasNoTrans, CblasNoTrans, N*C, S , 1,\n+      1., temp_NC.gpu_data(), ones_HW_.gpu_data(), 0., y);\n+}\n+\n+// y[c] = sum x(.,c,...)\n+template <typename Dtype>\n+void BatchNormLayer<Dtype>::compute_sum_per_channel_gpu(int N, int C, int S,\n+    const Dtype *x, Dtype *y ) {\n+  // assume that x.shape(1)==C\n+  Blob<Dtype> temp_NC;\n+  vector<int> temp_size;\n+  temp_size.push_back(N*C);\n+  temp_NC.Reshape(temp_size);\n+  caffe_gpu_gemv<Dtype>(CblasNoTrans, N * C, S, 1., x, ones_HW_.gpu_data(),\n+      0., temp_NC.mutable_gpu_data());\n+  caffe_gpu_gemv<Dtype>(CblasTrans, N, C, 1., temp_NC.gpu_data(),\n+      ones_N_.gpu_data(), 0., y);\n+}\n+\n+// y[c] = mean x(.,c,...)\n+template <typename Dtype>\n+void BatchNormLayer<Dtype>::compute_mean_per_channel_gpu(int N, int C, int S,\n+    const Dtype *x, Dtype *y ) {\n+  Dtype F = 1.0 / (N*S);\n+  compute_sum_per_channel_gpu(N, C, S, x, y);\n+  caffe_gpu_scale(C, F, y, y);\n+}\n+\n template <typename Dtype>\n void BatchNormLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom,\n     const vector<Blob<Dtype>*>& top) {\n+  int N = bottom[0]->shape(0);\n+  int C = channels_;\n+  int S = bottom[0]->count(0) / (N*C);\n+  int top_size = top[0]->count();\n+\n   const Dtype* bottom_data = bottom[0]->gpu_data();\n   Dtype* top_data = top[0]->mutable_gpu_data();\n-  int num = bottom[0]->shape(0);\n-  int spatial_dim = bottom[0]->count()/(channels_*bottom[0]->shape(0));\n-\n-  if (bottom[0] != top[0]) {\n-    caffe_copy(bottom[0]->count(), bottom_data, top_data);\n-  }\n \n+//  if (bottom[0] != top[0]) {","path":"src/caffe/layers/batch_norm_layer.cu","position":59,"original_position":59,"commit_id":"d3285ae361d549f384da1d306bd4e370116a2551","original_commit_id":"d3285ae361d549f384da1d306bd4e370116a2551","user":{"login":"ajtulloch","id":1121581,"avatar_url":"https://avatars.githubusercontent.com/u/1121581?v=3","gravatar_id":"","url":"https://api.github.com/users/ajtulloch","html_url":"https://github.com/ajtulloch","followers_url":"https://api.github.com/users/ajtulloch/followers","following_url":"https://api.github.com/users/ajtulloch/following{/other_user}","gists_url":"https://api.github.com/users/ajtulloch/gists{/gist_id}","starred_url":"https://api.github.com/users/ajtulloch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajtulloch/subscriptions","organizations_url":"https://api.github.com/users/ajtulloch/orgs","repos_url":"https://api.github.com/users/ajtulloch/repos","events_url":"https://api.github.com/users/ajtulloch/events{/privacy}","received_events_url":"https://api.github.com/users/ajtulloch/received_events","type":"User","site_admin":false},"body":"rm instead of commenting out?","created_at":"2016-04-17T20:17:06Z","updated_at":"2016-04-17T20:17:06Z","html_url":"https://github.com/BVLC/caffe/pull/3919#discussion_r59991656","pull_request_url":"https://api.github.com/repos/BVLC/caffe/pulls/3919","_links":{"self":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/comments/59991656"},"html":{"href":"https://github.com/BVLC/caffe/pull/3919#discussion_r59991656"},"pull_request":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/3919"}}},"pull_request":{"url":"https://api.github.com/repos/BVLC/caffe/pulls/3919","id":64716350,"html_url":"https://github.com/BVLC/caffe/pull/3919","diff_url":"https://github.com/BVLC/caffe/pull/3919.diff","patch_url":"https://github.com/BVLC/caffe/pull/3919.patch","issue_url":"https://api.github.com/repos/BVLC/caffe/issues/3919","number":3919,"state":"open","locked":false,"title":"CUB Memory Manager + cuDNN v4 and v5 support","user":{"login":"drnikolaev","id":7504104,"avatar_url":"https://avatars.githubusercontent.com/u/7504104?v=3","gravatar_id":"","url":"https://api.github.com/users/drnikolaev","html_url":"https://github.com/drnikolaev","followers_url":"https://api.github.com/users/drnikolaev/followers","following_url":"https://api.github.com/users/drnikolaev/following{/other_user}","gists_url":"https://api.github.com/users/drnikolaev/gists{/gist_id}","starred_url":"https://api.github.com/users/drnikolaev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drnikolaev/subscriptions","organizations_url":"https://api.github.com/users/drnikolaev/orgs","repos_url":"https://api.github.com/users/drnikolaev/repos","events_url":"https://api.github.com/users/drnikolaev/events{/privacy}","received_events_url":"https://api.github.com/users/drnikolaev/received_events","type":"User","site_admin":false},"body":"This PR adds two non-separatable features to Caffe: high performance CUB Memory Manager and long awaited upgrade from cuDNN v3 to cuDNN v4 (and upcoming v5) libraries.","created_at":"2016-03-30T23:59:20Z","updated_at":"2016-04-17T20:17:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ec0fcd68aa9384d3926f7f7b0a0c351ad67f5e4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/BVLC/caffe/pulls/3919/commits","review_comments_url":"https://api.github.com/repos/BVLC/caffe/pulls/3919/comments","review_comment_url":"https://api.github.com/repos/BVLC/caffe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BVLC/caffe/issues/3919/comments","statuses_url":"https://api.github.com/repos/BVLC/caffe/statuses/d3285ae361d549f384da1d306bd4e370116a2551","head":{"label":"drnikolaev:bvlc_cub_v4_v5","ref":"bvlc_cub_v4_v5","sha":"d3285ae361d549f384da1d306bd4e370116a2551","user":{"login":"drnikolaev","id":7504104,"avatar_url":"https://avatars.githubusercontent.com/u/7504104?v=3","gravatar_id":"","url":"https://api.github.com/users/drnikolaev","html_url":"https://github.com/drnikolaev","followers_url":"https://api.github.com/users/drnikolaev/followers","following_url":"https://api.github.com/users/drnikolaev/following{/other_user}","gists_url":"https://api.github.com/users/drnikolaev/gists{/gist_id}","starred_url":"https://api.github.com/users/drnikolaev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drnikolaev/subscriptions","organizations_url":"https://api.github.com/users/drnikolaev/orgs","repos_url":"https://api.github.com/users/drnikolaev/repos","events_url":"https://api.github.com/users/drnikolaev/events{/privacy}","received_events_url":"https://api.github.com/users/drnikolaev/received_events","type":"User","site_admin":false},"repo":{"id":43401733,"name":"caffe","full_name":"drnikolaev/caffe","owner":{"login":"drnikolaev","id":7504104,"avatar_url":"https://avatars.githubusercontent.com/u/7504104?v=3","gravatar_id":"","url":"https://api.github.com/users/drnikolaev","html_url":"https://github.com/drnikolaev","followers_url":"https://api.github.com/users/drnikolaev/followers","following_url":"https://api.github.com/users/drnikolaev/following{/other_user}","gists_url":"https://api.github.com/users/drnikolaev/gists{/gist_id}","starred_url":"https://api.github.com/users/drnikolaev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drnikolaev/subscriptions","organizations_url":"https://api.github.com/users/drnikolaev/orgs","repos_url":"https://api.github.com/users/drnikolaev/repos","events_url":"https://api.github.com/users/drnikolaev/events{/privacy}","received_events_url":"https://api.github.com/users/drnikolaev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/drnikolaev/caffe","description":"Caffe: a fast open framework for deep learning.","fork":true,"url":"https://api.github.com/repos/drnikolaev/caffe","forks_url":"https://api.github.com/repos/drnikolaev/caffe/forks","keys_url":"https://api.github.com/repos/drnikolaev/caffe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/drnikolaev/caffe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/drnikolaev/caffe/teams","hooks_url":"https://api.github.com/repos/drnikolaev/caffe/hooks","issue_events_url":"https://api.github.com/repos/drnikolaev/caffe/issues/events{/number}","events_url":"https://api.github.com/repos/drnikolaev/caffe/events","assignees_url":"https://api.github.com/repos/drnikolaev/caffe/assignees{/user}","branches_url":"https://api.github.com/repos/drnikolaev/caffe/branches{/branch}","tags_url":"https://api.github.com/repos/drnikolaev/caffe/tags","blobs_url":"https://api.github.com/repos/drnikolaev/caffe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/drnikolaev/caffe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/drnikolaev/caffe/git/refs{/sha}","trees_url":"https://api.github.com/repos/drnikolaev/caffe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/drnikolaev/caffe/statuses/{sha}","languages_url":"https://api.github.com/repos/drnikolaev/caffe/languages","stargazers_url":"https://api.github.com/repos/drnikolaev/caffe/stargazers","contributors_url":"https://api.github.com/repos/drnikolaev/caffe/contributors","subscribers_url":"https://api.github.com/repos/drnikolaev/caffe/subscribers","subscription_url":"https://api.github.com/repos/drnikolaev/caffe/subscription","commits_url":"https://api.github.com/repos/drnikolaev/caffe/commits{/sha}","git_commits_url":"https://api.github.com/repos/drnikolaev/caffe/git/commits{/sha}","comments_url":"https://api.github.com/repos/drnikolaev/caffe/comments{/number}","issue_comment_url":"https://api.github.com/repos/drnikolaev/caffe/issues/comments{/number}","contents_url":"https://api.github.com/repos/drnikolaev/caffe/contents/{+path}","compare_url":"https://api.github.com/repos/drnikolaev/caffe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/drnikolaev/caffe/merges","archive_url":"https://api.github.com/repos/drnikolaev/caffe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/drnikolaev/caffe/downloads","issues_url":"https://api.github.com/repos/drnikolaev/caffe/issues{/number}","pulls_url":"https://api.github.com/repos/drnikolaev/caffe/pulls{/number}","milestones_url":"https://api.github.com/repos/drnikolaev/caffe/milestones{/number}","notifications_url":"https://api.github.com/repos/drnikolaev/caffe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/drnikolaev/caffe/labels{/name}","releases_url":"https://api.github.com/repos/drnikolaev/caffe/releases{/id}","deployments_url":"https://api.github.com/repos/drnikolaev/caffe/deployments","created_at":"2015-09-30T00:14:03Z","updated_at":"2015-10-10T01:26:10Z","pushed_at":"2016-04-13T21:46:25Z","git_url":"git://github.com/drnikolaev/caffe.git","ssh_url":"git@github.com:drnikolaev/caffe.git","clone_url":"https://github.com/drnikolaev/caffe.git","svn_url":"https://github.com/drnikolaev/caffe","homepage":"http://caffe.berkeleyvision.org/","size":87713,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"BVLC:master","ref":"master","sha":"857eb2418fa336aadc5a795e4a16d02fadfc15f4","user":{"login":"BVLC","id":6182163,"avatar_url":"https://avatars.githubusercontent.com/u/6182163?v=3","gravatar_id":"","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?v=3","gravatar_id":"","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 open framework for deep learning.","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}","deployments_url":"https://api.github.com/repos/BVLC/caffe/deployments","created_at":"2013-09-12T18:39:48Z","updated_at":"2016-04-17T16:18:53Z","pushed_at":"2016-04-17T12:53:44Z","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":259485,"stargazers_count":9711,"watchers_count":9711,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5628,"mirror_url":null,"open_issues_count":614,"forks":5628,"open_issues":614,"watchers":9711,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/3919"},"html":{"href":"https://github.com/BVLC/caffe/pull/3919"},"issue":{"href":"https://api.github.com/repos/BVLC/caffe/issues/3919"},"comments":{"href":"https://api.github.com/repos/BVLC/caffe/issues/3919/comments"},"review_comments":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/3919/comments"},"review_comment":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/3919/commits"},"statuses":{"href":"https://api.github.com/repos/BVLC/caffe/statuses/d3285ae361d549f384da1d306bd4e370116a2551"}}}}