From 68e0848c4d5511812e8b018d78242ce1bf808ffd Mon Sep 17 00:00:00 2001 From: Aurelius84 Date: Fri, 27 Sep 2019 11:21:23 +0800 Subject: [PATCH] refine depth description in one_hot (#1425) --- doc/fluid/api_cn/fluid_cn/one_hot_cn.rst | 4 ++-- doc/fluid/api_cn/layers_cn/one_hot_cn.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/fluid/api_cn/fluid_cn/one_hot_cn.rst b/doc/fluid/api_cn/fluid_cn/one_hot_cn.rst index 625a2f1de..0d36a980e 100644 --- a/doc/fluid/api_cn/fluid_cn/one_hot_cn.rst +++ b/doc/fluid/api_cn/fluid_cn/one_hot_cn.rst @@ -5,7 +5,7 @@ one_hot .. py:function:: paddle.fluid.one_hot(input, depth, allow_out_of_range=False) -该OP将输入(input)中的每个词id转换为一个one-hot向量,其长度为字典大小(depth),该词id对应的向量维度上的值为1,其余维度的值为0。 +该OP将输入(input)中的每个id转换为一个one-hot向量,其长度为 ``depth`` ,该id对应的向量维度上的值为1,其余维度的值为0。 输出的Tensor(或LoDTensor)的shape是在输入shape的最后一维后面添加了depth的维度。 @@ -58,7 +58,7 @@ one_hot 参数: - **input** (Variable) - 维度为 :math:`[N_1, ..., N_n]` 的多维Tensor或LoDTensor,维度至少1维。数据类型为int32或int64。 - - **depth** (int) - 字典大小 + - **depth** (int) - 用于定义一个one-hot向量的长度。若输入为词id,则 ``depth`` 通常取值为词典大小。 - **allow_out_of_range** (bool) - 指明input中所包含的id值是否可以大于depth值。当超过depth时,如果 `allow_out_of_range` 为False,则会抛出 `Illegal value` 的异常;如果设置为True,该id对应的向量为0向量。默认值为False。 返回:转换后的one_hot Tensor或LoDTensor,数据类型为float32。 diff --git a/doc/fluid/api_cn/layers_cn/one_hot_cn.rst b/doc/fluid/api_cn/layers_cn/one_hot_cn.rst index a1979e679..d8f66f65e 100644 --- a/doc/fluid/api_cn/layers_cn/one_hot_cn.rst +++ b/doc/fluid/api_cn/layers_cn/one_hot_cn.rst @@ -7,7 +7,7 @@ one_hot **注意:此OP要求输入Tensor shape的最后一维必须为1。此OP将在未来的版本中被移除!推荐使用fluid.** :ref:`cn_api_fluid_one_hot` 。 -该OP将输入(input)中的每个词id转换为一个one-hot向量,其长度为字典大小(depth),该词id对应的向量维度上的值为1,其余维度的值为0。 +该OP将输入(input)中的每个id转换为一个one-hot向量,其长度为 ``depth`` ,该id对应的向量维度上的值为1,其余维度的值为0。 输出的Tensor(或LoDTensor)的shape是将输入shape的最后一维替换为depth的维度。 @@ -60,7 +60,7 @@ one_hot 参数: - **input** (Variable) - 维度为 :math:`[N_1, ..., N_n, 1]` 的多维Tensor或LoDTensor,维度至少两维,且最后一维必须是1。数据类型为int32或int64。 - - **depth** (int) - 字典大小 + - **depth** (int) - 用于定义一个one-hot向量的长度。若输入为词id,则 ``depth`` 通常取值为词典大小。 - **allow_out_of_range** (bool) - 指明input中所包含的id值是否可以大于depth值。当超过depth时,如果 `allow_out_of_range` 为False,则会抛出 `Illegal value` 的异常;如果设置为True,该id对应的向量为0向量。默认值为False。 返回:转换后的one_hot Tensor或LoDTensor,数据类型为float32。 -- GitLab