{"action":"created","comment":{"url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/pulls/comments/237364031","pull_request_review_id":179640601,"id":237364031,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNzM2NDAzMQ==","diff_hunk":"@@ -0,0 +1,65 @@\n+.. _api_guide_sparse_update:\r\n+\r\n+#####\r\n+稀疏更新\r\n+#####\r\n+\r\n+Fluid的 :ref:`api_fluid_layers_embedding`  层在单机训练和分布式训练时，均可以支持“稀疏更新”，即梯度以 `SelectedRows <https://github.com/PaddlePaddle/FluidDoc/blob/develop/doc/fluid/design/modules/selected_rows.md>`_  结构存储，只保存梯度不为0的行。\r\n+在分布式训练中，对于较大的embedding层，开启稀疏更新有助于减少通信数据量，提升训练速度\r\n+\r\n+embedding输入参数：\r\n+---------------------\r\n+\r\n+embedding需要输入(input)，形状(size)，是否需要稀疏更新(is_sparse)，是否使用分布式table(is_distributed)，是否padding输出(padding_idx)，参数属性(param_attr)，数据类型(dtype)来决定如何计算。\r\n+\r\n+- input:\r\n+\r\n+  input是一个Fluid的Variable, 其内容为需要查询的id向量。\r\n+- size:\r\n+\r\n+  size为lookup table的shape，必须为两维。以NLP应用为例，第0维一般为词典的大小，第1维一般为每个词对应向量的大小。\r\n+- is_sparse:\r\n+\r\n+  反向计算的时候梯度是否为 `sparse tensor <https://github.com/PaddlePaddle/FluidDoc/blob/develop/doc/fluid/design/modules/selected_rows.md>`_  。如果不设置，梯度是一个 `LodTensor <https://github.com/PaddlePaddle/FluidDoc/blob/develop/doc/fluid/design/concepts/lod_tensor.md>`_  。默认为False。\r\n+- is_distributed:\r\n+\r\n+  标志是否是用在分布式的场景下。一般大规模稀疏更新（embedding的第0维维度很大，比如几百万以上）才需要设置。具体可以参考大规模稀疏的API guide  :ref:`api_guide_async_training`  。默认为False。\r","path":"doc/fluid/api/api_guides/low_level/layers/sparse_update.rst","position":26,"original_position":26,"commit_id":"83b9110f94ad3ce9c3d3327036addc03a9265349","original_commit_id":"83b9110f94ad3ce9c3d3327036addc03a9265349","user":{"login":"shanyi15","id":35982308,"node_id":"MDQ6VXNlcjM1OTgyMzA4","avatar_url":"https://avatars1.githubusercontent.com/u/35982308?v=4","gravatar_id":"","url":"https://api.github.com/users/shanyi15","html_url":"https://github.com/shanyi15","followers_url":"https://api.github.com/users/shanyi15/followers","following_url":"https://api.github.com/users/shanyi15/following{/other_user}","gists_url":"https://api.github.com/users/shanyi15/gists{/gist_id}","starred_url":"https://api.github.com/users/shanyi15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shanyi15/subscriptions","organizations_url":"https://api.github.com/users/shanyi15/orgs","repos_url":"https://api.github.com/users/shanyi15/repos","events_url":"https://api.github.com/users/shanyi15/events{/privacy}","received_events_url":"https://api.github.com/users/shanyi15/received_events","type":"User","site_admin":false},"body":"```suggestion\r\n  标志是否用在分布式的场景下。一般大规模稀疏更新（embedding的第0维维度很大，比如几百万以上）才需要设置。具体可以参考大规模稀疏的API guide  :ref:`api_guide_async_training`  。默认为False。\r\n```","created_at":"2018-11-29T06:14:58Z","updated_at":"2018-11-29T06:15:32Z","html_url":"https://github.com/PaddlePaddle/FluidDoc/pull/399#discussion_r237364031","pull_request_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/pulls/399","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/PaddlePaddle/FluidDoc/pulls/comments/237364031"},"html":{"href":"https://github.com/PaddlePaddle/FluidDoc/pull/399#discussion_r237364031"},"pull_request":{"href":"https://api.github.com/repos/PaddlePaddle/FluidDoc/pulls/399"}}},"pull_request":{"url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/pulls/399","id":233765553,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzNzY1NTUz","html_url":"https://github.com/PaddlePaddle/FluidDoc/pull/399","diff_url":"https://github.com/PaddlePaddle/FluidDoc/pull/399.diff","patch_url":"https://github.com/PaddlePaddle/FluidDoc/pull/399.patch","issue_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/issues/399","number":399,"state":"open","locked":false,"title":"Add sparse update API guide.","user":{"login":"gongweibao","id":10721757,"node_id":"MDQ6VXNlcjEwNzIxNzU3","avatar_url":"https://avatars3.githubusercontent.com/u/10721757?v=4","gravatar_id":"","url":"https://api.github.com/users/gongweibao","html_url":"https://github.com/gongweibao","followers_url":"https://api.github.com/users/gongweibao/followers","following_url":"https://api.github.com/users/gongweibao/following{/other_user}","gists_url":"https://api.github.com/users/gongweibao/gists{/gist_id}","starred_url":"https://api.github.com/users/gongweibao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gongweibao/subscriptions","organizations_url":"https://api.github.com/users/gongweibao/orgs","repos_url":"https://api.github.com/users/gongweibao/repos","events_url":"https://api.github.com/users/gongweibao/events{/privacy}","received_events_url":"https://api.github.com/users/gongweibao/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-27T03:10:57Z","updated_at":"2018-11-29T06:15:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"31ff56da8dd9a0d3094c8168b54836c9edf772e5","assignee":null,"assignees":[],"requested_reviewers":[{"login":"tink2123","id":31891223,"node_id":"MDQ6VXNlcjMxODkxMjIz","avatar_url":"https://avatars3.githubusercontent.com/u/31891223?v=4","gravatar_id":"","url":"https://api.github.com/users/tink2123","html_url":"https://github.com/tink2123","followers_url":"https://api.github.com/users/tink2123/followers","following_url":"https://api.github.com/users/tink2123/following{/other_user}","gists_url":"https://api.github.com/users/tink2123/gists{/gist_id}","starred_url":"https://api.github.com/users/tink2123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tink2123/subscriptions","organizations_url":"https://api.github.com/users/tink2123/orgs","repos_url":"https://api.github.com/users/tink2123/repos","events_url":"https://api.github.com/users/tink2123/events{/privacy}","received_events_url":"https://api.github.com/users/tink2123/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":1088491885,"node_id":"MDU6TGFiZWwxMDg4NDkxODg1","url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/labels/API%20Guide","name":"API Guide","color":"cc0863","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/pulls/399/commits","review_comments_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/pulls/399/comments","review_comment_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/issues/399/comments","statuses_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/statuses/83b9110f94ad3ce9c3d3327036addc03a9265349","head":{"label":"gongweibao:sparseupdate","ref":"sparseupdate","sha":"83b9110f94ad3ce9c3d3327036addc03a9265349","user":{"login":"gongweibao","id":10721757,"node_id":"MDQ6VXNlcjEwNzIxNzU3","avatar_url":"https://avatars3.githubusercontent.com/u/10721757?v=4","gravatar_id":"","url":"https://api.github.com/users/gongweibao","html_url":"https://github.com/gongweibao","followers_url":"https://api.github.com/users/gongweibao/followers","following_url":"https://api.github.com/users/gongweibao/following{/other_user}","gists_url":"https://api.github.com/users/gongweibao/gists{/gist_id}","starred_url":"https://api.github.com/users/gongweibao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gongweibao/subscriptions","organizations_url":"https://api.github.com/users/gongweibao/orgs","repos_url":"https://api.github.com/users/gongweibao/repos","events_url":"https://api.github.com/users/gongweibao/events{/privacy}","received_events_url":"https://api.github.com/users/gongweibao/received_events","type":"User","site_admin":false},"repo":{"id":153284246,"node_id":"MDEwOlJlcG9zaXRvcnkxNTMyODQyNDY=","name":"FluidDoc","full_name":"gongweibao/FluidDoc","private":false,"owner":{"login":"gongweibao","id":10721757,"node_id":"MDQ6VXNlcjEwNzIxNzU3","avatar_url":"https://avatars3.githubusercontent.com/u/10721757?v=4","gravatar_id":"","url":"https://api.github.com/users/gongweibao","html_url":"https://github.com/gongweibao","followers_url":"https://api.github.com/users/gongweibao/followers","following_url":"https://api.github.com/users/gongweibao/following{/other_user}","gists_url":"https://api.github.com/users/gongweibao/gists{/gist_id}","starred_url":"https://api.github.com/users/gongweibao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gongweibao/subscriptions","organizations_url":"https://api.github.com/users/gongweibao/orgs","repos_url":"https://api.github.com/users/gongweibao/repos","events_url":"https://api.github.com/users/gongweibao/events{/privacy}","received_events_url":"https://api.github.com/users/gongweibao/received_events","type":"User","site_admin":false},"html_url":"https://github.com/gongweibao/FluidDoc","description":null,"fork":true,"url":"https://api.github.com/repos/gongweibao/FluidDoc","forks_url":"https://api.github.com/repos/gongweibao/FluidDoc/forks","keys_url":"https://api.github.com/repos/gongweibao/FluidDoc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gongweibao/FluidDoc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gongweibao/FluidDoc/teams","hooks_url":"https://api.github.com/repos/gongweibao/FluidDoc/hooks","issue_events_url":"https://api.github.com/repos/gongweibao/FluidDoc/issues/events{/number}","events_url":"https://api.github.com/repos/gongweibao/FluidDoc/events","assignees_url":"https://api.github.com/repos/gongweibao/FluidDoc/assignees{/user}","branches_url":"https://api.github.com/repos/gongweibao/FluidDoc/branches{/branch}","tags_url":"https://api.github.com/repos/gongweibao/FluidDoc/tags","blobs_url":"https://api.github.com/repos/gongweibao/FluidDoc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gongweibao/FluidDoc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gongweibao/FluidDoc/git/refs{/sha}","trees_url":"https://api.github.com/repos/gongweibao/FluidDoc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gongweibao/FluidDoc/statuses/{sha}","languages_url":"https://api.github.com/repos/gongweibao/FluidDoc/languages","stargazers_url":"https://api.github.com/repos/gongweibao/FluidDoc/stargazers","contributors_url":"https://api.github.com/repos/gongweibao/FluidDoc/contributors","subscribers_url":"https://api.github.com/repos/gongweibao/FluidDoc/subscribers","subscription_url":"https://api.github.com/repos/gongweibao/FluidDoc/subscription","commits_url":"https://api.github.com/repos/gongweibao/FluidDoc/commits{/sha}","git_commits_url":"https://api.github.com/repos/gongweibao/FluidDoc/git/commits{/sha}","comments_url":"https://api.github.com/repos/gongweibao/FluidDoc/comments{/number}","issue_comment_url":"https://api.github.com/repos/gongweibao/FluidDoc/issues/comments{/number}","contents_url":"https://api.github.com/repos/gongweibao/FluidDoc/contents/{+path}","compare_url":"https://api.github.com/repos/gongweibao/FluidDoc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gongweibao/FluidDoc/merges","archive_url":"https://api.github.com/repos/gongweibao/FluidDoc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gongweibao/FluidDoc/downloads","issues_url":"https://api.github.com/repos/gongweibao/FluidDoc/issues{/number}","pulls_url":"https://api.github.com/repos/gongweibao/FluidDoc/pulls{/number}","milestones_url":"https://api.github.com/repos/gongweibao/FluidDoc/milestones{/number}","notifications_url":"https://api.github.com/repos/gongweibao/FluidDoc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gongweibao/FluidDoc/labels{/name}","releases_url":"https://api.github.com/repos/gongweibao/FluidDoc/releases{/id}","deployments_url":"https://api.github.com/repos/gongweibao/FluidDoc/deployments","created_at":"2018-10-16T12:47:42Z","updated_at":"2018-10-16T12:47:44Z","pushed_at":"2018-11-28T07:49:43Z","git_url":"git://github.com/gongweibao/FluidDoc.git","ssh_url":"git@github.com:gongweibao/FluidDoc.git","clone_url":"https://github.com/gongweibao/FluidDoc.git","svn_url":"https://github.com/gongweibao/FluidDoc","homepage":null,"size":35009,"stargazers_count":0,"watchers_count":0,"language":"Shell","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":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"PaddlePaddle:develop","ref":"develop","sha":"d8f6f5d55d3342563d48f095d6817d707e010890","user":{"login":"PaddlePaddle","id":23534030,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzNTM0MDMw","avatar_url":"https://avatars3.githubusercontent.com/u/23534030?v=4","gravatar_id":"","url":"https://api.github.com/users/PaddlePaddle","html_url":"https://github.com/PaddlePaddle","followers_url":"https://api.github.com/users/PaddlePaddle/followers","following_url":"https://api.github.com/users/PaddlePaddle/following{/other_user}","gists_url":"https://api.github.com/users/PaddlePaddle/gists{/gist_id}","starred_url":"https://api.github.com/users/PaddlePaddle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PaddlePaddle/subscriptions","organizations_url":"https://api.github.com/users/PaddlePaddle/orgs","repos_url":"https://api.github.com/users/PaddlePaddle/repos","events_url":"https://api.github.com/users/PaddlePaddle/events{/privacy}","received_events_url":"https://api.github.com/users/PaddlePaddle/received_events","type":"Organization","site_admin":false},"repo":{"id":136450404,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY0NTA0MDQ=","name":"FluidDoc","full_name":"PaddlePaddle/FluidDoc","private":false,"owner":{"login":"PaddlePaddle","id":23534030,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzNTM0MDMw","avatar_url":"https://avatars3.githubusercontent.com/u/23534030?v=4","gravatar_id":"","url":"https://api.github.com/users/PaddlePaddle","html_url":"https://github.com/PaddlePaddle","followers_url":"https://api.github.com/users/PaddlePaddle/followers","following_url":"https://api.github.com/users/PaddlePaddle/following{/other_user}","gists_url":"https://api.github.com/users/PaddlePaddle/gists{/gist_id}","starred_url":"https://api.github.com/users/PaddlePaddle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PaddlePaddle/subscriptions","organizations_url":"https://api.github.com/users/PaddlePaddle/orgs","repos_url":"https://api.github.com/users/PaddlePaddle/repos","events_url":"https://api.github.com/users/PaddlePaddle/events{/privacy}","received_events_url":"https://api.github.com/users/PaddlePaddle/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/PaddlePaddle/FluidDoc","description":"Documentations for PaddlePaddle","fork":false,"url":"https://api.github.com/repos/PaddlePaddle/FluidDoc","forks_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/forks","keys_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/teams","hooks_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/hooks","issue_events_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/issues/events{/number}","events_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/events","assignees_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/assignees{/user}","branches_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/branches{/branch}","tags_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/tags","blobs_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/git/refs{/sha}","trees_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/statuses/{sha}","languages_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/languages","stargazers_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/stargazers","contributors_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/contributors","subscribers_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/subscribers","subscription_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/subscription","commits_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/commits{/sha}","git_commits_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/git/commits{/sha}","comments_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/comments{/number}","issue_comment_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/issues/comments{/number}","contents_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/contents/{+path}","compare_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/merges","archive_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/downloads","issues_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/issues{/number}","pulls_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/pulls{/number}","milestones_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/milestones{/number}","notifications_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/labels{/name}","releases_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/releases{/id}","deployments_url":"https://api.github.com/repos/PaddlePaddle/FluidDoc/deployments","created_at":"2018-06-07T08:58:28Z","updated_at":"2018-11-28T10:57:30Z","pushed_at":"2018-11-29T02:28:14Z","git_url":"git://github.com/PaddlePaddle/FluidDoc.git","ssh_url":"git@github.com:PaddlePaddle/FluidDoc.git","clone_url":"https://github.com/PaddlePaddle/FluidDoc.git","svn_url":"https://github.com/PaddlePaddle/FluidDoc","homepage":"http://paddlepaddle.org/documentation/zh","size":35229,"stargazers_count":6,"watchers_count":6,"language":"Shell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":42,"license":null,"forks":41,"open_issues":42,"watchers":6,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/PaddlePaddle/FluidDoc/pulls/399"},"html":{"href":"https://github.com/PaddlePaddle/FluidDoc/pull/399"},"issue":{"href":"https://api.github.com/repos/PaddlePaddle/FluidDoc/issues/399"},"comments":{"href":"https://api.github.com/repos/PaddlePaddle/FluidDoc/issues/399/comments"},"review_comments":{"href":"https://api.github.com/repos/PaddlePaddle/FluidDoc/pulls/399/comments"},"review_comment":{"href":"https://api.github.com/repos/PaddlePaddle/FluidDoc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PaddlePaddle/FluidDoc/pulls/399/commits"},"statuses":{"href":"https://api.github.com/repos/PaddlePaddle/FluidDoc/statuses/83b9110f94ad3ce9c3d3327036addc03a9265349"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"shanyi15"}}