{"action":"created","comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/comments/181511920","pull_request_review_id":112124549,"id":181511920,"diff_hunk":"@@ -0,0 +1,81 @@\n+/* Copyright 2018 The TensorFlow Authors. All Rights Reserved.\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+==============================================================================*/\n+\n+#include \"tensorflow/contrib/tensorrt/plugin/trt_plugin_factory.h\"\n+\n+#if GOOGLE_CUDA\n+#if GOOGLE_TENSORRT\n+\n+namespace tensorflow {\n+namespace tensorrt {\n+\n+PluginTensorRT* PluginFactoryTensorRT::createPlugin(const char* layerName,\n+                                                    const void* serial_data,\n+                                                    size_t serial_length) {\n+  size_t parsed_byte = 0;\n+  // extract op_name from serial_data\n+  size_t encoded_op_name =\n+      ExtractOpName(serial_data, serial_length, parsed_byte);\n+\n+  if (!IsPlugin(encoded_op_name)) {\n+    return nullptr;\n+  }\n+\n+  // should I lock plugins here?\n+  instance_m_.lock();\n+  auto plugin_ptr =\n+      plugin_registry_[encoded_op_name].first(serial_data, serial_length);\n+  // string op_name = \"IncPluginTRT\";\n+  // auto plugin_ptr = plugin_registry_[EncodeLayerName(&op_name)].second();\n+  // auto plugin_ptr = plugin_registry_.begin()->second.second();\n+  owned_plugins_.emplace_back(plugin_ptr);\n+  instance_m_.unlock();\n+\n+  return plugin_ptr;\n+}\n+\n+PluginTensorRT* PluginFactoryTensorRT::CreatePlugin(const string* op_name) {\n+  if (!IsPlugin(op_name)) return nullptr;\n+\n+  instance_m_.lock();\n+  auto plugin_ptr = plugin_registry_[EncodeLayerName(op_name)].second();\n+  owned_plugins_.emplace_back(plugin_ptr);\n+  instance_m_.unlock();\n+\n+  return plugin_ptr;\n+}\n+\n+bool PluginFactoryTensorRT::RegisterPlugin(\n+    const string* op_name, PluginDeserializeFunc deserialize_func,\n+    PluginConstructFunc construct_func) {\n+  if (IsPlugin(op_name)) return false;\n+\n+  // get instance_m_ first before write to registry;\n+  instance_m_.lock();\n+  auto ret = plugin_registry_.emplace(\n+      EncodeLayerName(op_name),\n+      std::make_pair(deserialize_func, construct_func));\n+  instance_m_.unlock();\n+\n+  return ret.second;\n+}\n+\n+void PluginFactoryTensorRT::DestroyPlugins() { return; }","path":"tensorflow/contrib/tensorrt/plugin/trt_plugin_factory.cc","position":75,"original_position":75,"commit_id":"9d1aa895adda8644ddbb55b5e1dbb0797ea6cbb0","original_commit_id":"9d1aa895adda8644ddbb55b5e1dbb0797ea6cbb0","user":{"login":"aaroey","id":31743510,"avatar_url":"https://avatars0.githubusercontent.com/u/31743510?v=4","gravatar_id":"","url":"https://api.github.com/users/aaroey","html_url":"https://github.com/aaroey","followers_url":"https://api.github.com/users/aaroey/followers","following_url":"https://api.github.com/users/aaroey/following{/other_user}","gists_url":"https://api.github.com/users/aaroey/gists{/gist_id}","starred_url":"https://api.github.com/users/aaroey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaroey/subscriptions","organizations_url":"https://api.github.com/users/aaroey/orgs","repos_url":"https://api.github.com/users/aaroey/repos","events_url":"https://api.github.com/users/aaroey/events{/privacy}","received_events_url":"https://api.github.com/users/aaroey/received_events","type":"User","site_admin":false},"body":"Why not destroying?","created_at":"2018-04-13T21:15:33Z","updated_at":"2018-04-13T21:41:17Z","html_url":"https://github.com/tensorflow/tensorflow/pull/18433#discussion_r181511920","pull_request_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/18433","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/comments/181511920"},"html":{"href":"https://github.com/tensorflow/tensorflow/pull/18433#discussion_r181511920"},"pull_request":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/18433"}}},"pull_request":{"url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/18433","id":181040925,"html_url":"https://github.com/tensorflow/tensorflow/pull/18433","diff_url":"https://github.com/tensorflow/tensorflow/pull/18433.diff","patch_url":"https://github.com/tensorflow/tensorflow/pull/18433.patch","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/18433","number":18433,"state":"open","locked":false,"title":"[tftrt update]","user":{"login":"jjsjann123","id":3709243,"avatar_url":"https://avatars3.githubusercontent.com/u/3709243?v=4","gravatar_id":"","url":"https://api.github.com/users/jjsjann123","html_url":"https://github.com/jjsjann123","followers_url":"https://api.github.com/users/jjsjann123/followers","following_url":"https://api.github.com/users/jjsjann123/following{/other_user}","gists_url":"https://api.github.com/users/jjsjann123/gists{/gist_id}","starred_url":"https://api.github.com/users/jjsjann123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjsjann123/subscriptions","organizations_url":"https://api.github.com/users/jjsjann123/orgs","repos_url":"https://api.github.com/users/jjsjann123/repos","events_url":"https://api.github.com/users/jjsjann123/events{/privacy}","received_events_url":"https://api.github.com/users/jjsjann123/received_events","type":"User","site_admin":false},"body":"  Added support for TRT plugin during conversion\r\n  - converter & shape inference are now aware of plugin factory.\r\n  - each plugin does serialization of plugin type & input dimensions\r\n  - wrapper for nvinfer1::IPlugin & nvinfer1::PluginFactory\r\n\r\n  * compatible with TRT 3.0.4 plugin API.\r\n  * future plugin API changes willl be updated.","created_at":"2018-04-11T22:04:50Z","updated_at":"2018-04-13T21:41:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f2ebc6c0dd06d96856cbe043d2ec64c44a33949","assignee":{"login":"aaroey","id":31743510,"avatar_url":"https://avatars0.githubusercontent.com/u/31743510?v=4","gravatar_id":"","url":"https://api.github.com/users/aaroey","html_url":"https://github.com/aaroey","followers_url":"https://api.github.com/users/aaroey/followers","following_url":"https://api.github.com/users/aaroey/following{/other_user}","gists_url":"https://api.github.com/users/aaroey/gists{/gist_id}","starred_url":"https://api.github.com/users/aaroey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaroey/subscriptions","organizations_url":"https://api.github.com/users/aaroey/orgs","repos_url":"https://api.github.com/users/aaroey/repos","events_url":"https://api.github.com/users/aaroey/events{/privacy}","received_events_url":"https://api.github.com/users/aaroey/received_events","type":"User","site_admin":false},"assignees":[{"login":"aaroey","id":31743510,"avatar_url":"https://avatars0.githubusercontent.com/u/31743510?v=4","gravatar_id":"","url":"https://api.github.com/users/aaroey","html_url":"https://github.com/aaroey","followers_url":"https://api.github.com/users/aaroey/followers","following_url":"https://api.github.com/users/aaroey/following{/other_user}","gists_url":"https://api.github.com/users/aaroey/gists{/gist_id}","starred_url":"https://api.github.com/users/aaroey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaroey/subscriptions","organizations_url":"https://api.github.com/users/aaroey/orgs","repos_url":"https://api.github.com/users/aaroey/repos","events_url":"https://api.github.com/users/aaroey/events{/privacy}","received_events_url":"https://api.github.com/users/aaroey/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":300136587,"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/cla:%20yes","name":"cla: yes","color":"009800","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/18433/commits","review_comments_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/18433/comments","review_comment_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/18433/comments","statuses_url":"https://api.github.com/repos/tensorflow/tensorflow/statuses/9d1aa895adda8644ddbb55b5e1dbb0797ea6cbb0","head":{"label":"samikama:plugin_master_pr","ref":"plugin_master_pr","sha":"9d1aa895adda8644ddbb55b5e1dbb0797ea6cbb0","user":{"login":"samikama","id":10539540,"avatar_url":"https://avatars0.githubusercontent.com/u/10539540?v=4","gravatar_id":"","url":"https://api.github.com/users/samikama","html_url":"https://github.com/samikama","followers_url":"https://api.github.com/users/samikama/followers","following_url":"https://api.github.com/users/samikama/following{/other_user}","gists_url":"https://api.github.com/users/samikama/gists{/gist_id}","starred_url":"https://api.github.com/users/samikama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samikama/subscriptions","organizations_url":"https://api.github.com/users/samikama/orgs","repos_url":"https://api.github.com/users/samikama/repos","events_url":"https://api.github.com/users/samikama/events{/privacy}","received_events_url":"https://api.github.com/users/samikama/received_events","type":"User","site_admin":false},"repo":{"id":56879599,"name":"tensorflow","full_name":"samikama/tensorflow","owner":{"login":"samikama","id":10539540,"avatar_url":"https://avatars0.githubusercontent.com/u/10539540?v=4","gravatar_id":"","url":"https://api.github.com/users/samikama","html_url":"https://github.com/samikama","followers_url":"https://api.github.com/users/samikama/followers","following_url":"https://api.github.com/users/samikama/following{/other_user}","gists_url":"https://api.github.com/users/samikama/gists{/gist_id}","starred_url":"https://api.github.com/users/samikama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samikama/subscriptions","organizations_url":"https://api.github.com/users/samikama/orgs","repos_url":"https://api.github.com/users/samikama/repos","events_url":"https://api.github.com/users/samikama/events{/privacy}","received_events_url":"https://api.github.com/users/samikama/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/samikama/tensorflow","description":"Computation using data flow graphs for scalable machine learning","fork":true,"url":"https://api.github.com/repos/samikama/tensorflow","forks_url":"https://api.github.com/repos/samikama/tensorflow/forks","keys_url":"https://api.github.com/repos/samikama/tensorflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/samikama/tensorflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/samikama/tensorflow/teams","hooks_url":"https://api.github.com/repos/samikama/tensorflow/hooks","issue_events_url":"https://api.github.com/repos/samikama/tensorflow/issues/events{/number}","events_url":"https://api.github.com/repos/samikama/tensorflow/events","assignees_url":"https://api.github.com/repos/samikama/tensorflow/assignees{/user}","branches_url":"https://api.github.com/repos/samikama/tensorflow/branches{/branch}","tags_url":"https://api.github.com/repos/samikama/tensorflow/tags","blobs_url":"https://api.github.com/repos/samikama/tensorflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/samikama/tensorflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/samikama/tensorflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/samikama/tensorflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/samikama/tensorflow/statuses/{sha}","languages_url":"https://api.github.com/repos/samikama/tensorflow/languages","stargazers_url":"https://api.github.com/repos/samikama/tensorflow/stargazers","contributors_url":"https://api.github.com/repos/samikama/tensorflow/contributors","subscribers_url":"https://api.github.com/repos/samikama/tensorflow/subscribers","subscription_url":"https://api.github.com/repos/samikama/tensorflow/subscription","commits_url":"https://api.github.com/repos/samikama/tensorflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/samikama/tensorflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/samikama/tensorflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/samikama/tensorflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/samikama/tensorflow/contents/{+path}","compare_url":"https://api.github.com/repos/samikama/tensorflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/samikama/tensorflow/merges","archive_url":"https://api.github.com/repos/samikama/tensorflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/samikama/tensorflow/downloads","issues_url":"https://api.github.com/repos/samikama/tensorflow/issues{/number}","pulls_url":"https://api.github.com/repos/samikama/tensorflow/pulls{/number}","milestones_url":"https://api.github.com/repos/samikama/tensorflow/milestones{/number}","notifications_url":"https://api.github.com/repos/samikama/tensorflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/samikama/tensorflow/labels{/name}","releases_url":"https://api.github.com/repos/samikama/tensorflow/releases{/id}","deployments_url":"https://api.github.com/repos/samikama/tensorflow/deployments","created_at":"2016-04-22T19:17:04Z","updated_at":"2018-04-13T18:20:33Z","pushed_at":"2018-04-13T18:18:59Z","git_url":"git://github.com/samikama/tensorflow.git","ssh_url":"git@github.com:samikama/tensorflow.git","clone_url":"https://github.com/samikama/tensorflow.git","svn_url":"https://github.com/samikama/tensorflow","homepage":"http://tensorflow.org","size":160454,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tensorflow:master","ref":"master","sha":"b1f028cce18204114c0c8224f7258b75e53687f2","user":{"login":"tensorflow","id":15658638,"avatar_url":"https://avatars1.githubusercontent.com/u/15658638?v=4","gravatar_id":"","url":"https://api.github.com/users/tensorflow","html_url":"https://github.com/tensorflow","followers_url":"https://api.github.com/users/tensorflow/followers","following_url":"https://api.github.com/users/tensorflow/following{/other_user}","gists_url":"https://api.github.com/users/tensorflow/gists{/gist_id}","starred_url":"https://api.github.com/users/tensorflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tensorflow/subscriptions","organizations_url":"https://api.github.com/users/tensorflow/orgs","repos_url":"https://api.github.com/users/tensorflow/repos","events_url":"https://api.github.com/users/tensorflow/events{/privacy}","received_events_url":"https://api.github.com/users/tensorflow/received_events","type":"Organization","site_admin":false},"repo":{"id":45717250,"name":"tensorflow","full_name":"tensorflow/tensorflow","owner":{"login":"tensorflow","id":15658638,"avatar_url":"https://avatars1.githubusercontent.com/u/15658638?v=4","gravatar_id":"","url":"https://api.github.com/users/tensorflow","html_url":"https://github.com/tensorflow","followers_url":"https://api.github.com/users/tensorflow/followers","following_url":"https://api.github.com/users/tensorflow/following{/other_user}","gists_url":"https://api.github.com/users/tensorflow/gists{/gist_id}","starred_url":"https://api.github.com/users/tensorflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tensorflow/subscriptions","organizations_url":"https://api.github.com/users/tensorflow/orgs","repos_url":"https://api.github.com/users/tensorflow/repos","events_url":"https://api.github.com/users/tensorflow/events{/privacy}","received_events_url":"https://api.github.com/users/tensorflow/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tensorflow/tensorflow","description":"Computation using data flow graphs for scalable machine learning","fork":false,"url":"https://api.github.com/repos/tensorflow/tensorflow","forks_url":"https://api.github.com/repos/tensorflow/tensorflow/forks","keys_url":"https://api.github.com/repos/tensorflow/tensorflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tensorflow/tensorflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tensorflow/tensorflow/teams","hooks_url":"https://api.github.com/repos/tensorflow/tensorflow/hooks","issue_events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/events{/number}","events_url":"https://api.github.com/repos/tensorflow/tensorflow/events","assignees_url":"https://api.github.com/repos/tensorflow/tensorflow/assignees{/user}","branches_url":"https://api.github.com/repos/tensorflow/tensorflow/branches{/branch}","tags_url":"https://api.github.com/repos/tensorflow/tensorflow/tags","blobs_url":"https://api.github.com/repos/tensorflow/tensorflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tensorflow/tensorflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tensorflow/tensorflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/tensorflow/tensorflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tensorflow/tensorflow/statuses/{sha}","languages_url":"https://api.github.com/repos/tensorflow/tensorflow/languages","stargazers_url":"https://api.github.com/repos/tensorflow/tensorflow/stargazers","contributors_url":"https://api.github.com/repos/tensorflow/tensorflow/contributors","subscribers_url":"https://api.github.com/repos/tensorflow/tensorflow/subscribers","subscription_url":"https://api.github.com/repos/tensorflow/tensorflow/subscription","commits_url":"https://api.github.com/repos/tensorflow/tensorflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/tensorflow/tensorflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/tensorflow/tensorflow/contents/{+path}","compare_url":"https://api.github.com/repos/tensorflow/tensorflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tensorflow/tensorflow/merges","archive_url":"https://api.github.com/repos/tensorflow/tensorflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tensorflow/tensorflow/downloads","issues_url":"https://api.github.com/repos/tensorflow/tensorflow/issues{/number}","pulls_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls{/number}","milestones_url":"https://api.github.com/repos/tensorflow/tensorflow/milestones{/number}","notifications_url":"https://api.github.com/repos/tensorflow/tensorflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/labels{/name}","releases_url":"https://api.github.com/repos/tensorflow/tensorflow/releases{/id}","deployments_url":"https://api.github.com/repos/tensorflow/tensorflow/deployments","created_at":"2015-11-07T01:19:20Z","updated_at":"2018-04-13T21:34:11Z","pushed_at":"2018-04-13T21:15:40Z","git_url":"git://github.com/tensorflow/tensorflow.git","ssh_url":"git@github.com:tensorflow/tensorflow.git","clone_url":"https://github.com/tensorflow/tensorflow.git","svn_url":"https://github.com/tensorflow/tensorflow","homepage":"https://tensorflow.org","size":160925,"stargazers_count":96163,"watchers_count":96163,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":61254,"mirror_url":null,"archived":false,"open_issues_count":1504,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":61254,"open_issues":1504,"watchers":96163,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/18433"},"html":{"href":"https://github.com/tensorflow/tensorflow/pull/18433"},"issue":{"href":"https://api.github.com/repos/tensorflow/tensorflow/issues/18433"},"comments":{"href":"https://api.github.com/repos/tensorflow/tensorflow/issues/18433/comments"},"review_comments":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/18433/comments"},"review_comment":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/18433/commits"},"statuses":{"href":"https://api.github.com/repos/tensorflow/tensorflow/statuses/9d1aa895adda8644ddbb55b5e1dbb0797ea6cbb0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"aaroey"}}