未验证 提交 6b744866 编写于 作者: T tangwei12 提交者: GitHub

fix en doc for emb (#31980)

* fix en doc for emb, test=document_fix;
Change-Id: I4757e67caacd7189f068493ed45a7445f87ffb40
上级 eb3199fc
...@@ -148,9 +148,7 @@ def embedding(x, weight, padding_idx=None, sparse=False, name=None): ...@@ -148,9 +148,7 @@ def embedding(x, weight, padding_idx=None, sparse=False, name=None):
sparse(bool): The flag indicating whether to use sparse update. This parameter only sparse(bool): The flag indicating whether to use sparse update. This parameter only
affects the performance of the backwards gradient update. It is recommended to set affects the performance of the backwards gradient update. It is recommended to set
True because sparse update is faster. But some optimizers does not support sparse update, True because sparse update is faster. But some optimizers does not support sparse update,
such as :ref:`api_optimizer_AdadeltaOptimizer` , :ref:`api_optimizer_AdamaxOptimizer` , such as :ref:`api_paddle_optimizer_adadelta_Adadelta` , :ref:`api_paddle_optimizer_adamax_Adamax` , :ref:`api_paddle_optimizer_lamb_Lamb`.
:ref:`api_optimizer_DecayedAdagradOptimizer` , :ref:`api_optimizer_FtrlOptimizer` ,
:ref:`api_optimizer_LambOptimizer` and :ref:`api_optimizer_LarsMomentumOptimizer` .
In these cases, sparse must be False. Default: False. In these cases, sparse must be False. Default: False.
padding_idx(int|long|None): padding_idx needs to be in the interval [-weight.shape[0], weight.shape[0]). padding_idx(int|long|None): padding_idx needs to be in the interval [-weight.shape[0], weight.shape[0]).
If :math:`padding\_idx < 0`, the :math:`padding\_idx` will automatically be converted If :math:`padding\_idx < 0`, the :math:`padding\_idx` will automatically be converted
......
...@@ -1229,7 +1229,7 @@ class Embedding(layers.Layer): ...@@ -1229,7 +1229,7 @@ class Embedding(layers.Layer):
For specific usage, refer to code examples. It implements the function of the Embedding Layer. For specific usage, refer to code examples. It implements the function of the Embedding Layer.
This layer is used to lookup embeddings vector of ids provided by :attr:`x` . This layer is used to lookup embeddings vector of ids provided by :attr:`x` .
It automatically constructs a 2D embedding matrix based on the It automatically constructs a 2D embedding matrix based on the
input :attr:`num_embeddings` and attr:`embedding_dim`. input :attr:`num_embeddings` and :attr:`embedding_dim`.
The shape of output Tensor is generated by appending an emb_size dimension to the The shape of output Tensor is generated by appending an emb_size dimension to the
last dimension of the input Tensor shape. last dimension of the input Tensor shape.
...@@ -1241,9 +1241,9 @@ class Embedding(layers.Layer): ...@@ -1241,9 +1241,9 @@ class Embedding(layers.Layer):
Case 1: Case 1:
input is a Tensor. padding_idx = -1 x is a Tensor. padding_idx = -1
input.data = [[1, 3], [2, 4], [4, 127] x.data = [[1, 3], [2, 4], [4, 127]
input.shape = [3, 2] x.shape = [3, 2]
Given size = [128, 16] Given size = [128, 16]
output is a Tensor: output is a Tensor:
out.shape = [3, 2, 16] out.shape = [3, 2, 16]
...@@ -1261,7 +1261,7 @@ class Embedding(layers.Layer): ...@@ -1261,7 +1261,7 @@ class Embedding(layers.Layer):
Parameters: Parameters:
num_embeddings (int): Just one element which indicate the size num_embeddings (int): Just one element which indicate the size
of the dictionary of embeddings. of the dictionary of embeddings.
embedding_dim: Just one element which indicate the size of each embedding vector respectively. embedding_dim (int): Just one element which indicate the size of each embedding vector respectively.
padding_idx(int|long|None): padding_idx needs to be in the interval [-num_embeddings, num_embeddings). padding_idx(int|long|None): padding_idx needs to be in the interval [-num_embeddings, num_embeddings).
If :math:`padding\_idx < 0`, the :math:`padding\_idx` will automatically be converted If :math:`padding\_idx < 0`, the :math:`padding\_idx` will automatically be converted
to :math:`vocab\_size + padding\_idx` . It will output all-zero padding data whenever lookup to :math:`vocab\_size + padding\_idx` . It will output all-zero padding data whenever lookup
...@@ -1270,9 +1270,7 @@ class Embedding(layers.Layer): ...@@ -1270,9 +1270,7 @@ class Embedding(layers.Layer):
sparse(bool): The flag indicating whether to use sparse update. This parameter only sparse(bool): The flag indicating whether to use sparse update. This parameter only
affects the performance of the backwards gradient update. It is recommended to set affects the performance of the backwards gradient update. It is recommended to set
True because sparse update is faster. But some optimizer does not support sparse update, True because sparse update is faster. But some optimizer does not support sparse update,
such as :ref:`api_optimizer_AdadeltaOptimizer` , :ref:`api_optimizer_AdamaxOptimizer` , such as :ref:`api_paddle_optimizer_adadelta_Adadelta` , :ref:`api_paddle_optimizer_adamax_Adamax` , :ref:`api_paddle_optimizer_lamb_Lamb`.
:ref:`api_optimizer_DecayedAdagradOptimizer` , :ref:`api_optimizer_FtrlOptimizer` ,
:ref:`api_optimizer_LambOptimizer` and :ref:`api_optimizer_LarsMomentumOptimizer` .
In these case, sparse must be False. Default: False. In these case, sparse must be False. Default: False.
weight_attr(ParamAttr): To specify the weight parameter property. Default: None, which means the weight_attr(ParamAttr): To specify the weight parameter property. Default: None, which means the
default weight parameter property is used. See usage for details in :ref:`api_ParamAttr` . In addition, default weight parameter property is used. See usage for details in :ref:`api_ParamAttr` . In addition,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册