{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/onnxruntime/pulls/comments/243467745","pull_request_review_id":187246567,"id":243467745,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MzQ2Nzc0NQ==","diff_hunk":"@@ -0,0 +1,225 @@\n+#include \"word_conv_embedding.h\"\n+\n+#include \"core/util/math.h\"\n+#include \"core/util/math_cpuonly.h\"\n+#include \"core/mlas/inc/mlas.h\"\n+\n+namespace onnxruntime {\n+namespace contrib {\n+\n+void WordConvEmbedding::CharEmbeddingLookup(\n+    const int* seq_ptr,\n+    const float* char_embedding_weight_p,\n+    size_t seq_len,\n+    size_t word_len,\n+    size_t char_embedding_size,\n+    const int* words_len_ptr,\n+    float* dst) const {\n+  for (size_t word_inx = 0; word_inx < seq_len; word_inx++) {\n+    if (words_len_ptr[word_inx] > 0) {\n+      const int* cur_seq_ptr = seq_ptr + word_inx * word_len;\n+      float* cur_dst_ptr = dst + word_inx * word_len * char_embedding_size;\n+      for (size_t char_inx = 0; char_inx < word_len; char_inx++) {\n+        memcpy(cur_dst_ptr, char_embedding_weight_p + (*cur_seq_ptr) * char_embedding_size, sizeof(float) * char_embedding_size);\n+        cur_dst_ptr += char_embedding_size;\n+        cur_seq_ptr++;\n+      }\n+    }\n+  }\n+}\n+\n+//input : [batch, sequence_length, word_length, char_embedding_size]\n+void WordConvEmbedding::ComputeConvMaxPoolWithActivation(\n+    AllocatorPtr allocator,\n+    const float* input,\n+    const float* weights,\n+    const float* bias,\n+    const int* words_len_ptr,\n+    int64_t seq_len,\n+    int64_t word_len,\n+    int64_t char_embedding_size,\n+    int64_t filter_width,\n+    int64_t num_filters,\n+    float* output) const {\n+  int64_t input_word_size = word_len * char_embedding_size;\n+  int64_t unfolded_width = word_len - filter_width + 1;\n+  int64_t unfolded_kernal_size = filter_width * char_embedding_size;\n+  int64_t unfolded_segment_size = unfolded_width * unfolded_kernal_size;\n+  //int conv_res_segment_size = _filter_width * _num_filters; // TODO: it imay be unfolded_width * _num_filters\n+  int64_t conv_res_segment_size = unfolded_width * num_filters;\n+  int64_t memcpy_size = unfolded_kernal_size * sizeof(float);\n+\n+  IAllocatorUniquePtr<float> input_unfolded_buffer_p = IAllocator::MakeUniquePtr<float>(allocator, seq_len * unfolded_segment_size);\n+  IAllocatorUniquePtr<float> conv_result_p = IAllocator::MakeUniquePtr<float>(allocator, seq_len * conv_res_segment_size);\n+  IAllocatorUniquePtr<float> conv_activation_result_p = IAllocator::MakeUniquePtr<float>(allocator, seq_len * conv_res_segment_size);\n+\n+  //   omp_set_nested( true );\n+  //   omp_set_dynamic( false );\n+  //   omp_set_num_threads( 24 );\n+  //\n+  //#pragma omp parallel for num_threads(nt)","path":"onnxruntime/contrib_ops/cpu/word_conv_embedding.cc","position":null,"original_position":60,"commit_id":"d740ffca9cdbb0a850c6cbf2983c6f8b7cc78eb6","original_commit_id":"fafcd9220ca1ff63771242d6d0fedd7989d67ad0","user":{"login":"duli2012","id":2879800,"node_id":"MDQ6VXNlcjI4Nzk4MDA=","avatar_url":"https://avatars3.githubusercontent.com/u/2879800?v=4","gravatar_id":"","url":"https://api.github.com/users/duli2012","html_url":"https://github.com/duli2012","followers_url":"https://api.github.com/users/duli2012/followers","following_url":"https://api.github.com/users/duli2012/following{/other_user}","gists_url":"https://api.github.com/users/duli2012/gists{/gist_id}","starred_url":"https://api.github.com/users/duli2012/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duli2012/subscriptions","organizations_url":"https://api.github.com/users/duli2012/orgs","repos_url":"https://api.github.com/users/duli2012/repos","events_url":"https://api.github.com/users/duli2012/events{/privacy}","received_events_url":"https://api.github.com/users/duli2012/received_events","type":"User","site_admin":false},"body":"I think we should remove all these comments.","created_at":"2018-12-21T01:32:13Z","updated_at":"2018-12-21T01:32:13Z","html_url":"https://github.com/Microsoft/onnxruntime/pull/229#discussion_r243467745","pull_request_url":"https://api.github.com/repos/Microsoft/onnxruntime/pulls/229","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/onnxruntime/pulls/comments/243467745"},"html":{"href":"https://github.com/Microsoft/onnxruntime/pull/229#discussion_r243467745"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/onnxruntime/pulls/229"}},"in_reply_to_id":243429359},"pull_request":{"url":"https://api.github.com/repos/Microsoft/onnxruntime/pulls/229","id":240032368,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQwMDMyMzY4","html_url":"https://github.com/Microsoft/onnxruntime/pull/229","diff_url":"https://github.com/Microsoft/onnxruntime/pull/229.diff","patch_url":"https://github.com/Microsoft/onnxruntime/pull/229.patch","issue_url":"https://api.github.com/repos/Microsoft/onnxruntime/issues/229","number":229,"state":"open","locked":false,"title":"Add word conv embedding custom op","user":{"login":"yufenglee","id":30486710,"node_id":"MDQ6VXNlcjMwNDg2NzEw","avatar_url":"https://avatars2.githubusercontent.com/u/30486710?v=4","gravatar_id":"","url":"https://api.github.com/users/yufenglee","html_url":"https://github.com/yufenglee","followers_url":"https://api.github.com/users/yufenglee/followers","following_url":"https://api.github.com/users/yufenglee/following{/other_user}","gists_url":"https://api.github.com/users/yufenglee/gists{/gist_id}","starred_url":"https://api.github.com/users/yufenglee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yufenglee/subscriptions","organizations_url":"https://api.github.com/users/yufenglee/orgs","repos_url":"https://api.github.com/users/yufenglee/repos","events_url":"https://api.github.com/users/yufenglee/events{/privacy}","received_events_url":"https://api.github.com/users/yufenglee/received_events","type":"User","site_admin":false},"body":"Add a WordConvEmbedding custom op that can embed a sequence of words to vector. With this custom op, AGI encoder model runs 30% faster. ","created_at":"2018-12-20T02:18:40Z","updated_at":"2018-12-21T01:32:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5baf479e9aebe1da391a918703dbf3bdc462049d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/onnxruntime/pulls/229/commits","review_comments_url":"https://api.github.com/repos/Microsoft/onnxruntime/pulls/229/comments","review_comment_url":"https://api.github.com/repos/Microsoft/onnxruntime/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/onnxruntime/issues/229/comments","statuses_url":"https://api.github.com/repos/Microsoft/onnxruntime/statuses/d740ffca9cdbb0a850c6cbf2983c6f8b7cc78eb6","head":{"label":"Microsoft:roli/agi-encoder_rewrite","ref":"roli/agi-encoder_rewrite","sha":"d740ffca9cdbb0a850c6cbf2983c6f8b7cc78eb6","user":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":156939672,"node_id":"MDEwOlJlcG9zaXRvcnkxNTY5Mzk2NzI=","name":"onnxruntime","full_name":"Microsoft/onnxruntime","private":false,"owner":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Microsoft/onnxruntime","description":"ONNX Runtime","fork":false,"url":"https://api.github.com/repos/Microsoft/onnxruntime","forks_url":"https://api.github.com/repos/Microsoft/onnxruntime/forks","keys_url":"https://api.github.com/repos/Microsoft/onnxruntime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/onnxruntime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/onnxruntime/teams","hooks_url":"https://api.github.com/repos/Microsoft/onnxruntime/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/onnxruntime/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/onnxruntime/events","assignees_url":"https://api.github.com/repos/Microsoft/onnxruntime/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/onnxruntime/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/onnxruntime/tags","blobs_url":"https://api.github.com/repos/Microsoft/onnxruntime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/onnxruntime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/onnxruntime/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/onnxruntime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/onnxruntime/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/onnxruntime/languages","stargazers_url":"https://api.github.com/repos/Microsoft/onnxruntime/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/onnxruntime/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/onnxruntime/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/onnxruntime/subscription","commits_url":"https://api.github.com/repos/Microsoft/onnxruntime/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/onnxruntime/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/onnxruntime/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/onnxruntime/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/onnxruntime/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/onnxruntime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/onnxruntime/merges","archive_url":"https://api.github.com/repos/Microsoft/onnxruntime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/onnxruntime/downloads","issues_url":"https://api.github.com/repos/Microsoft/onnxruntime/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/onnxruntime/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/onnxruntime/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/onnxruntime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/onnxruntime/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/onnxruntime/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/onnxruntime/deployments","created_at":"2018-11-10T02:22:53Z","updated_at":"2018-12-20T23:46:46Z","pushed_at":"2018-12-21T01:16:15Z","git_url":"git://github.com/Microsoft/onnxruntime.git","ssh_url":"git@github.com:Microsoft/onnxruntime.git","clone_url":"https://github.com/Microsoft/onnxruntime.git","svn_url":"https://github.com/Microsoft/onnxruntime","homepage":null,"size":28647,"stargazers_count":415,"watchers_count":415,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":59,"mirror_url":null,"archived":false,"open_issues_count":29,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":59,"open_issues":29,"watchers":415,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"0dca08023894857fcc88c4a53ffb9a92b78287c5","user":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":156939672,"node_id":"MDEwOlJlcG9zaXRvcnkxNTY5Mzk2NzI=","name":"onnxruntime","full_name":"Microsoft/onnxruntime","private":false,"owner":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Microsoft/onnxruntime","description":"ONNX Runtime","fork":false,"url":"https://api.github.com/repos/Microsoft/onnxruntime","forks_url":"https://api.github.com/repos/Microsoft/onnxruntime/forks","keys_url":"https://api.github.com/repos/Microsoft/onnxruntime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/onnxruntime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/onnxruntime/teams","hooks_url":"https://api.github.com/repos/Microsoft/onnxruntime/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/onnxruntime/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/onnxruntime/events","assignees_url":"https://api.github.com/repos/Microsoft/onnxruntime/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/onnxruntime/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/onnxruntime/tags","blobs_url":"https://api.github.com/repos/Microsoft/onnxruntime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/onnxruntime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/onnxruntime/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/onnxruntime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/onnxruntime/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/onnxruntime/languages","stargazers_url":"https://api.github.com/repos/Microsoft/onnxruntime/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/onnxruntime/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/onnxruntime/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/onnxruntime/subscription","commits_url":"https://api.github.com/repos/Microsoft/onnxruntime/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/onnxruntime/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/onnxruntime/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/onnxruntime/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/onnxruntime/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/onnxruntime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/onnxruntime/merges","archive_url":"https://api.github.com/repos/Microsoft/onnxruntime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/onnxruntime/downloads","issues_url":"https://api.github.com/repos/Microsoft/onnxruntime/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/onnxruntime/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/onnxruntime/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/onnxruntime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/onnxruntime/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/onnxruntime/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/onnxruntime/deployments","created_at":"2018-11-10T02:22:53Z","updated_at":"2018-12-20T23:46:46Z","pushed_at":"2018-12-21T01:16:15Z","git_url":"git://github.com/Microsoft/onnxruntime.git","ssh_url":"git@github.com:Microsoft/onnxruntime.git","clone_url":"https://github.com/Microsoft/onnxruntime.git","svn_url":"https://github.com/Microsoft/onnxruntime","homepage":null,"size":28647,"stargazers_count":415,"watchers_count":415,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":59,"mirror_url":null,"archived":false,"open_issues_count":29,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":59,"open_issues":29,"watchers":415,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/onnxruntime/pulls/229"},"html":{"href":"https://github.com/Microsoft/onnxruntime/pull/229"},"issue":{"href":"https://api.github.com/repos/Microsoft/onnxruntime/issues/229"},"comments":{"href":"https://api.github.com/repos/Microsoft/onnxruntime/issues/229/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/onnxruntime/pulls/229/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/onnxruntime/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/onnxruntime/pulls/229/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/onnxruntime/statuses/d740ffca9cdbb0a850c6cbf2983c6f8b7cc78eb6"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"duli2012"}}