{"action":"created","comment":{"url":"https://api.github.com/repos/onnx/onnx/pulls/comments/189407386","pull_request_review_id":121589722,"id":189407386,"diff_hunk":"@@ -575,11 +591,32 @@ std::ostream& operator<<(std::ostream& out, const OpSchema& schema) {\n   return out;\n }\n \n-OpName_Domain_Version_Schema_Map& OpSchemaRegistry::map() {\n+// Private method used by OpSchemaRegisterOnce and OpSchemaRegistry::map()\n+OpName_Domain_Version_Schema_Map& OpSchemaRegistry::GetMapWithoutEnsuringRegistration() {\n   static OpName_Domain_Version_Schema_Map map;\n   return map;\n }\n \n+OpName_Domain_Version_Schema_Map& OpSchemaRegistry::map() {  \n+  auto& map = GetMapWithoutEnsuringRegistration();\n+\n+  class SchemasRegisterer {\n+    public:\n+      SchemasRegisterer() {\n+        RegisterOnnxOperatorSetSchema();\n+#ifdef ONNX_ML\n+        RegisterOnnxMLOperatorSetSchema();\n+#endif    \n+      }\n+  };\n+\n+  #ifndef ONNX_DISABLE_STATIC_REGISTRATION","path":"onnx/defs/schema.cc","position":193,"original_position":193,"commit_id":"5893cd5bd4e49b618ce92a433e84b78ccd49abb1","original_commit_id":"5893cd5bd4e49b618ce92a433e84b78ccd49abb1","user":{"login":"jeffbloo","id":38966965,"avatar_url":"https://avatars0.githubusercontent.com/u/38966965?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffbloo","html_url":"https://github.com/jeffbloo","followers_url":"https://api.github.com/users/jeffbloo/followers","following_url":"https://api.github.com/users/jeffbloo/following{/other_user}","gists_url":"https://api.github.com/users/jeffbloo/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffbloo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffbloo/subscriptions","organizations_url":"https://api.github.com/users/jeffbloo/orgs","repos_url":"https://api.github.com/users/jeffbloo/repos","events_url":"https://api.github.com/users/jeffbloo/events{/privacy}","received_events_url":"https://api.github.com/users/jeffbloo/received_events","type":"User","site_admin":false},"body":"This applies to your question below about custom schema. They may also implement ISchemaRegistry.","created_at":"2018-05-18T22:35:18Z","updated_at":"2018-05-18T22:35:18Z","html_url":"https://github.com/onnx/onnx/pull/894#discussion_r189407386","pull_request_url":"https://api.github.com/repos/onnx/onnx/pulls/894","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/onnx/onnx/pulls/comments/189407386"},"html":{"href":"https://github.com/onnx/onnx/pull/894#discussion_r189407386"},"pull_request":{"href":"https://api.github.com/repos/onnx/onnx/pulls/894"}},"in_reply_to_id":189185767},"pull_request":{"url":"https://api.github.com/repos/onnx/onnx/pulls/894","id":186119240,"html_url":"https://github.com/onnx/onnx/pull/894","diff_url":"https://github.com/onnx/onnx/pull/894.diff","patch_url":"https://github.com/onnx/onnx/pull/894.patch","issue_url":"https://api.github.com/repos/onnx/onnx/issues/894","number":894,"state":"open","locked":false,"title":"Enable non-static schema registration","user":{"login":"jeffbloo","id":38966965,"avatar_url":"https://avatars0.githubusercontent.com/u/38966965?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffbloo","html_url":"https://github.com/jeffbloo","followers_url":"https://api.github.com/users/jeffbloo/followers","following_url":"https://api.github.com/users/jeffbloo/following{/other_user}","gists_url":"https://api.github.com/users/jeffbloo/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffbloo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffbloo/subscriptions","organizations_url":"https://api.github.com/users/jeffbloo/orgs","repos_url":"https://api.github.com/users/jeffbloo/repos","events_url":"https://api.github.com/users/jeffbloo/events{/privacy}","received_events_url":"https://api.github.com/users/jeffbloo/received_events","type":"User","site_admin":false},"body":"This proposed changed introduces an alternate approach to registering operator schema.  \r\n\r\nBefore this change, schema are registered using a macro (ONNX_OPERATOR_SCHEMA) which populates a static map.  This change preserves that functionality unless a macro is defined (ONNX_NON_STATIC_SCHEMA_INITIALIZATION).  If that macro is defined, ONNX_OPERATOR_SCHEMA instead defines a function which may be called at any point to retrieve the schema, which can then be added to any map or registry.\r\n\r\nThe motivation for this change is two-fold.  First, it transfers policy to the consumer for which operator schema and versions of those schema will be registered.  Second, it avoids a pattern of static object usage which can cause downstream compilation and performance issues.\r\n\r\nSo that consumers may generate code with calls to the new registration functions, the macros are now always called from the ONNNX namespace.  The codebase was previously inconsistent on using either this or the global namespace.  The objects defined in this macro also use a naming convention, which includes the name, domain, and version which reflects the operator set within which it was first defined.  This affects the macro syntax and removes the need to use __COUNTER__ for uniqueness.  \r\n","created_at":"2018-05-04T22:41:36Z","updated_at":"2018-05-18T22:35:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ec3f9fdc61f2c7dd97e933e6545734d119d03f0","assignee":null,"assignees":[],"requested_reviewers":[{"login":"anirudhacharya","id":2778341,"avatar_url":"https://avatars0.githubusercontent.com/u/2778341?v=4","gravatar_id":"","url":"https://api.github.com/users/anirudhacharya","html_url":"https://github.com/anirudhacharya","followers_url":"https://api.github.com/users/anirudhacharya/followers","following_url":"https://api.github.com/users/anirudhacharya/following{/other_user}","gists_url":"https://api.github.com/users/anirudhacharya/gists{/gist_id}","starred_url":"https://api.github.com/users/anirudhacharya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anirudhacharya/subscriptions","organizations_url":"https://api.github.com/users/anirudhacharya/orgs","repos_url":"https://api.github.com/users/anirudhacharya/repos","events_url":"https://api.github.com/users/anirudhacharya/events{/privacy}","received_events_url":"https://api.github.com/users/anirudhacharya/received_events","type":"User","site_admin":false},{"login":"lupesko","id":3321001,"avatar_url":"https://avatars1.githubusercontent.com/u/3321001?v=4","gravatar_id":"","url":"https://api.github.com/users/lupesko","html_url":"https://github.com/lupesko","followers_url":"https://api.github.com/users/lupesko/followers","following_url":"https://api.github.com/users/lupesko/following{/other_user}","gists_url":"https://api.github.com/users/lupesko/gists{/gist_id}","starred_url":"https://api.github.com/users/lupesko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lupesko/subscriptions","organizations_url":"https://api.github.com/users/lupesko/orgs","repos_url":"https://api.github.com/users/lupesko/repos","events_url":"https://api.github.com/users/lupesko/events{/privacy}","received_events_url":"https://api.github.com/users/lupesko/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/onnx/onnx/pulls/894/commits","review_comments_url":"https://api.github.com/repos/onnx/onnx/pulls/894/comments","review_comment_url":"https://api.github.com/repos/onnx/onnx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/onnx/onnx/issues/894/comments","statuses_url":"https://api.github.com/repos/onnx/onnx/statuses/5893cd5bd4e49b618ce92a433e84b78ccd49abb1","head":{"label":"jeffbloo:jeffbloo/NonStaticSchemaReg","ref":"jeffbloo/NonStaticSchemaReg","sha":"5893cd5bd4e49b618ce92a433e84b78ccd49abb1","user":{"login":"jeffbloo","id":38966965,"avatar_url":"https://avatars0.githubusercontent.com/u/38966965?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffbloo","html_url":"https://github.com/jeffbloo","followers_url":"https://api.github.com/users/jeffbloo/followers","following_url":"https://api.github.com/users/jeffbloo/following{/other_user}","gists_url":"https://api.github.com/users/jeffbloo/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffbloo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffbloo/subscriptions","organizations_url":"https://api.github.com/users/jeffbloo/orgs","repos_url":"https://api.github.com/users/jeffbloo/repos","events_url":"https://api.github.com/users/jeffbloo/events{/privacy}","received_events_url":"https://api.github.com/users/jeffbloo/received_events","type":"User","site_admin":false},"repo":{"id":132182912,"name":"onnx","full_name":"jeffbloo/onnx","owner":{"login":"jeffbloo","id":38966965,"avatar_url":"https://avatars0.githubusercontent.com/u/38966965?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffbloo","html_url":"https://github.com/jeffbloo","followers_url":"https://api.github.com/users/jeffbloo/followers","following_url":"https://api.github.com/users/jeffbloo/following{/other_user}","gists_url":"https://api.github.com/users/jeffbloo/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffbloo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffbloo/subscriptions","organizations_url":"https://api.github.com/users/jeffbloo/orgs","repos_url":"https://api.github.com/users/jeffbloo/repos","events_url":"https://api.github.com/users/jeffbloo/events{/privacy}","received_events_url":"https://api.github.com/users/jeffbloo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeffbloo/onnx","description":"Open Neural Network Exchange","fork":true,"url":"https://api.github.com/repos/jeffbloo/onnx","forks_url":"https://api.github.com/repos/jeffbloo/onnx/forks","keys_url":"https://api.github.com/repos/jeffbloo/onnx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeffbloo/onnx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeffbloo/onnx/teams","hooks_url":"https://api.github.com/repos/jeffbloo/onnx/hooks","issue_events_url":"https://api.github.com/repos/jeffbloo/onnx/issues/events{/number}","events_url":"https://api.github.com/repos/jeffbloo/onnx/events","assignees_url":"https://api.github.com/repos/jeffbloo/onnx/assignees{/user}","branches_url":"https://api.github.com/repos/jeffbloo/onnx/branches{/branch}","tags_url":"https://api.github.com/repos/jeffbloo/onnx/tags","blobs_url":"https://api.github.com/repos/jeffbloo/onnx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeffbloo/onnx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeffbloo/onnx/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeffbloo/onnx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeffbloo/onnx/statuses/{sha}","languages_url":"https://api.github.com/repos/jeffbloo/onnx/languages","stargazers_url":"https://api.github.com/repos/jeffbloo/onnx/stargazers","contributors_url":"https://api.github.com/repos/jeffbloo/onnx/contributors","subscribers_url":"https://api.github.com/repos/jeffbloo/onnx/subscribers","subscription_url":"https://api.github.com/repos/jeffbloo/onnx/subscription","commits_url":"https://api.github.com/repos/jeffbloo/onnx/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeffbloo/onnx/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeffbloo/onnx/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeffbloo/onnx/issues/comments{/number}","contents_url":"https://api.github.com/repos/jeffbloo/onnx/contents/{+path}","compare_url":"https://api.github.com/repos/jeffbloo/onnx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeffbloo/onnx/merges","archive_url":"https://api.github.com/repos/jeffbloo/onnx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeffbloo/onnx/downloads","issues_url":"https://api.github.com/repos/jeffbloo/onnx/issues{/number}","pulls_url":"https://api.github.com/repos/jeffbloo/onnx/pulls{/number}","milestones_url":"https://api.github.com/repos/jeffbloo/onnx/milestones{/number}","notifications_url":"https://api.github.com/repos/jeffbloo/onnx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeffbloo/onnx/labels{/name}","releases_url":"https://api.github.com/repos/jeffbloo/onnx/releases{/id}","deployments_url":"https://api.github.com/repos/jeffbloo/onnx/deployments","created_at":"2018-05-04T19:52:02Z","updated_at":"2018-05-04T19:52:05Z","pushed_at":"2018-05-18T07:17:57Z","git_url":"git://github.com/jeffbloo/onnx.git","ssh_url":"git@github.com:jeffbloo/onnx.git","clone_url":"https://github.com/jeffbloo/onnx.git","svn_url":"https://github.com/jeffbloo/onnx","homepage":"https://onnx.ai/","size":4862,"stargazers_count":0,"watchers_count":0,"language":"PureBasic","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"onnx:master","ref":"master","sha":"8356ad54e9173cfb8dfae6d25a67278e6d48bbb2","user":{"login":"onnx","id":31675368,"avatar_url":"https://avatars3.githubusercontent.com/u/31675368?v=4","gravatar_id":"","url":"https://api.github.com/users/onnx","html_url":"https://github.com/onnx","followers_url":"https://api.github.com/users/onnx/followers","following_url":"https://api.github.com/users/onnx/following{/other_user}","gists_url":"https://api.github.com/users/onnx/gists{/gist_id}","starred_url":"https://api.github.com/users/onnx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onnx/subscriptions","organizations_url":"https://api.github.com/users/onnx/orgs","repos_url":"https://api.github.com/users/onnx/repos","events_url":"https://api.github.com/users/onnx/events{/privacy}","received_events_url":"https://api.github.com/users/onnx/received_events","type":"Organization","site_admin":false},"repo":{"id":102692863,"name":"onnx","full_name":"onnx/onnx","owner":{"login":"onnx","id":31675368,"avatar_url":"https://avatars3.githubusercontent.com/u/31675368?v=4","gravatar_id":"","url":"https://api.github.com/users/onnx","html_url":"https://github.com/onnx","followers_url":"https://api.github.com/users/onnx/followers","following_url":"https://api.github.com/users/onnx/following{/other_user}","gists_url":"https://api.github.com/users/onnx/gists{/gist_id}","starred_url":"https://api.github.com/users/onnx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onnx/subscriptions","organizations_url":"https://api.github.com/users/onnx/orgs","repos_url":"https://api.github.com/users/onnx/repos","events_url":"https://api.github.com/users/onnx/events{/privacy}","received_events_url":"https://api.github.com/users/onnx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/onnx/onnx","description":"Open Neural Network Exchange","fork":false,"url":"https://api.github.com/repos/onnx/onnx","forks_url":"https://api.github.com/repos/onnx/onnx/forks","keys_url":"https://api.github.com/repos/onnx/onnx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onnx/onnx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onnx/onnx/teams","hooks_url":"https://api.github.com/repos/onnx/onnx/hooks","issue_events_url":"https://api.github.com/repos/onnx/onnx/issues/events{/number}","events_url":"https://api.github.com/repos/onnx/onnx/events","assignees_url":"https://api.github.com/repos/onnx/onnx/assignees{/user}","branches_url":"https://api.github.com/repos/onnx/onnx/branches{/branch}","tags_url":"https://api.github.com/repos/onnx/onnx/tags","blobs_url":"https://api.github.com/repos/onnx/onnx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onnx/onnx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onnx/onnx/git/refs{/sha}","trees_url":"https://api.github.com/repos/onnx/onnx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onnx/onnx/statuses/{sha}","languages_url":"https://api.github.com/repos/onnx/onnx/languages","stargazers_url":"https://api.github.com/repos/onnx/onnx/stargazers","contributors_url":"https://api.github.com/repos/onnx/onnx/contributors","subscribers_url":"https://api.github.com/repos/onnx/onnx/subscribers","subscription_url":"https://api.github.com/repos/onnx/onnx/subscription","commits_url":"https://api.github.com/repos/onnx/onnx/commits{/sha}","git_commits_url":"https://api.github.com/repos/onnx/onnx/git/commits{/sha}","comments_url":"https://api.github.com/repos/onnx/onnx/comments{/number}","issue_comment_url":"https://api.github.com/repos/onnx/onnx/issues/comments{/number}","contents_url":"https://api.github.com/repos/onnx/onnx/contents/{+path}","compare_url":"https://api.github.com/repos/onnx/onnx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onnx/onnx/merges","archive_url":"https://api.github.com/repos/onnx/onnx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onnx/onnx/downloads","issues_url":"https://api.github.com/repos/onnx/onnx/issues{/number}","pulls_url":"https://api.github.com/repos/onnx/onnx/pulls{/number}","milestones_url":"https://api.github.com/repos/onnx/onnx/milestones{/number}","notifications_url":"https://api.github.com/repos/onnx/onnx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onnx/onnx/labels{/name}","releases_url":"https://api.github.com/repos/onnx/onnx/releases{/id}","deployments_url":"https://api.github.com/repos/onnx/onnx/deployments","created_at":"2017-09-07T04:53:45Z","updated_at":"2018-05-18T21:48:12Z","pushed_at":"2018-05-18T21:27:19Z","git_url":"git://github.com/onnx/onnx.git","ssh_url":"git@github.com:onnx/onnx.git","clone_url":"https://github.com/onnx/onnx.git","svn_url":"https://github.com/onnx/onnx","homepage":"https://onnx.ai/","size":4833,"stargazers_count":3450,"watchers_count":3450,"language":"PureBasic","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":433,"mirror_url":null,"archived":false,"open_issues_count":182,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":433,"open_issues":182,"watchers":3450,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/onnx/onnx/pulls/894"},"html":{"href":"https://github.com/onnx/onnx/pull/894"},"issue":{"href":"https://api.github.com/repos/onnx/onnx/issues/894"},"comments":{"href":"https://api.github.com/repos/onnx/onnx/issues/894/comments"},"review_comments":{"href":"https://api.github.com/repos/onnx/onnx/pulls/894/comments"},"review_comment":{"href":"https://api.github.com/repos/onnx/onnx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/onnx/onnx/pulls/894/commits"},"statuses":{"href":"https://api.github.com/repos/onnx/onnx/statuses/5893cd5bd4e49b618ce92a433e84b78ccd49abb1"}},"author_association":"NONE"}}
{"actor":{"display_login":"jeffbloo"}}