diff --git a/docs/api/paddle/Tensor__upper_cn.rst b/docs/api/paddle/Tensor__upper_cn.rst index 7a0ffcc7876..223e609154d 100755 --- a/docs/api/paddle/Tensor__upper_cn.rst +++ b/docs/api/paddle/Tensor__upper_cn.rst @@ -571,7 +571,7 @@ add(y, name=None, \*, alpha=1, out=None) add_(y, name=None, \*, alpha=1, out=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_add` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_add` API,对输入 ``x`` 采用 Inplace 策略。 add_n(inputs, name=None) ::::::::: @@ -641,7 +641,7 @@ COPY-FROM: paddle.Tensor.apply apply_(callable) ::::::::: -Inplace 版本的 `apply` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 ``apply`` API,对输入 ``x`` 采用 Inplace 策略。 argmax(axis=None, keepdim=False, dtype=int64, name=None) ::::::::: @@ -978,7 +978,7 @@ bincount(weights=None, minlength=0) bernoulli_(p=0.5, name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_bernoulli` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_bernoulli` API,对输入 ``x`` 采用 Inplace 策略。 bitwise_and(y, out=None, name=None) ::::::::: @@ -1072,7 +1072,7 @@ ceil(name=None) ceil_(name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_ceil` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_ceil` API,对输入 ``x`` 采用 Inplace 策略。 cholesky(upper=False, name=None) ::::::::: @@ -1123,7 +1123,7 @@ clip(min=None, max=None, name=None) clip_(min=None, max=None, name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_clip` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_clip` API,对输入 ``x`` 采用 Inplace 策略。 clone() ::::::::: @@ -1423,7 +1423,7 @@ exp(name=None) exp_(name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_exp` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_exp` API,对输入 ``x`` 采用 Inplace 策略。 expand(shape, name=None) ::::::::: @@ -1583,7 +1583,7 @@ fill_diagonal_tensor(x, y, offset=0, dim1=0, dim2=1, name=None) fill_diagonal_tensor_(x, y, offset=0, dim1=0, dim2=1, name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_fill_diagonal_tensor` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_fill_diagonal_tensor` API,对输入 ``x`` 采用 Inplace 策略。 **代码示例** .. code-block:: python @@ -1606,7 +1606,7 @@ flatten(start_axis=0, stop_axis=-1, name=None) flatten_(start_axis=0, stop_axis=-1, name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_flatten` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_flatten` API,对输入 ``x`` 采用 Inplace 策略。 flip(axis, name=None) ::::::::: @@ -1638,7 +1638,7 @@ floor(name=None) floor_(name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_floor` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_floor` API,对输入 ``x`` 采用 Inplace 策略。 floor_divide(y, name=None) ::::::::: @@ -2055,7 +2055,7 @@ logsumexp(axis=None, keepdim=False, name=None) log_normal_(mean=0.0, std=1.0, name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_log_normal` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_log_normal` API,对输入 ``x`` 采用 Inplace 策略。 请参考 :ref:`cn_api_paddle_logsumexp` @@ -2385,7 +2385,7 @@ reciprocal(name=None) reciprocal_(name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_reciprocal` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_reciprocal` API,对输入 ``x`` 采用 Inplace 策略。 register_hook(hook) ::::::::: @@ -2462,7 +2462,7 @@ remainder_(y, name=None) 返回类型:Tensor -Inplace 版本的 :ref:`cn_api_paddle_remainder` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_remainder` API,对输入 ``x`` 采用 Inplace 策略。 reshape(shape, name=None) ::::::::: @@ -2485,7 +2485,7 @@ ravel() reshape_(shape, name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_reshape` API,对输入 `x` 采用 Inplace 策略 +Inplace 版本的 :ref:`cn_api_paddle_reshape` API,对输入 ``x`` 采用 Inplace 策略 roll(shifts, axis=None, name=None) ::::::::: @@ -2508,7 +2508,7 @@ round(name=None) round_(name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_round` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_round` API,对输入 ``x`` 采用 Inplace 策略。 rsqrt(name=None) ::::::::: @@ -2522,7 +2522,7 @@ rsqrt(name=None) rsqrt_(name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_rsqrt` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_rsqrt` API,对输入 ``x`` 采用 Inplace 策略。 scale(scale=1.0, bias=0.0, bias_after_scale=True, act=None, name=None) ::::::::: @@ -2536,7 +2536,7 @@ scale(scale=1.0, bias=0.0, bias_after_scale=True, act=None, name=None) scale_(scale=1.0, bias=0.0, bias_after_scale=True, act=None, name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_scale` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_scale` API,对输入 ``x`` 采用 Inplace 策略。 scatter(index, updates, overwrite=True, name=None) ::::::::: @@ -2550,7 +2550,7 @@ scatter(index, updates, overwrite=True, name=None) scatter_(index, updates, overwrite=True, name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_scatter` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_scatter` API,对输入 ``x`` 采用 Inplace 策略。 scatter_add(index, updates, overwrite=True, name=None) ::::::::: @@ -2761,7 +2761,7 @@ sqrt(name=None, \*, out=None) sqrt_(name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_sqrt` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_sqrt` API,对输入 ``x`` 采用 Inplace 策略。 square(name=None) ::::::::: @@ -2784,7 +2784,7 @@ squeeze(axis=None, name=None) squeeze_(axis=None, name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_squeeze` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_squeeze` API,对输入 ``x`` 采用 Inplace 策略。 stack(axis=0, name=None) ::::::::: @@ -2834,7 +2834,7 @@ subtract(y, name=None, \*, alpha=1, out=None) subtract_(y, name=None, \*, alpha=1) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_subtract` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_subtract` API,对输入 ``x`` 采用 Inplace 策略。 sub(y, name=None, \*, alpha=1, out=None) ::::::::: @@ -2848,7 +2848,7 @@ sub(y, name=None, \*, alpha=1, out=None) sub_(y, name=None, \*, alpha=1) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_sub` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_sub` API,对输入 ``x`` 采用 Inplace 策略。 sum(axis=None, dtype=None, keepdim=False, name=None) ::::::::: @@ -2898,7 +2898,7 @@ tanh(name=None) tanh_(name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_tan` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_tan` API,对输入 ``x`` 采用 Inplace 策略。 tile(repeat_times, name=None) ::::::::: @@ -3096,7 +3096,7 @@ unsqueeze(axis, name=None) unsqueeze_(axis, name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_unsqueeze` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_unsqueeze` API,对输入 ``x`` 采用 Inplace 策略。 unstack(axis=0, num=None) ::::::::: @@ -3119,16 +3119,16 @@ var(axis=None, unbiased=True, keepdim=False, name=None) where(x, y, name=None) ::::::::: -调用该 `where` 方法的 `Tensor` 作为 `condition` 来选择 `x` 或 `y` 中的对应元素组成新的 `Tensor` 并返回。 +调用该 ``where`` 方法的 ``Tensor`` 作为 ``condition`` 来选择 ``x`` 或 ``y`` 中的对应元素组成新的 ``Tensor`` 并返回。 返回:计算后的 Tensor 返回类型:Tensor .. note:: - 只有 `bool` 类型的 `Tensor` 才能调用该方法。 + 只有 ``bool`` 类型的 ``Tensor`` 才能调用该方法。 -示例:`(x>0).where(x, y)`, 其中 x, y 都是数值 `Tensor`。 +示例:``(x>0).where(x, y)``, 其中 x, y 都是数值 ``Tensor``。 请参考 :ref:`cn_api_paddle_where` @@ -3173,7 +3173,7 @@ lerp(x, y, weight, name=None) lerp_(y, weight, name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_lerp` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_lerp` API,对输入 ``x`` 采用 Inplace 策略。 is_complex() @@ -3357,7 +3357,7 @@ nnz() ::::::::: .. note:: - 只有 `SparseCooTensor` 、`SparseCsrTensor` 才可调用该方法。 + 只有 ``SparseCooTensor`` 、``SparseCsrTensor`` 才可调用该方法。 返回:输入稀疏 Tensor 的非 0 元素的个数 @@ -3380,7 +3380,7 @@ indices() ::::::::: .. note:: - 只有 `SparseCooTensor` 才可调用该方法。 + 只有 ``SparseCooTensor`` 才可调用该方法。 返回:输入 SparseCooTensor 的非 0 元素的索引 @@ -3405,7 +3405,7 @@ values() ::::::::: .. note:: - 只有 `SparseCooTensor` 才可调用该方法。 + 只有 ``SparseCooTensor`` 才可调用该方法。 返回:输入 SparseCooTensor 的非 0 元素的值 @@ -3430,7 +3430,7 @@ crows() ::::::::: .. note:: - 只有 `SparseCsrTensor` 才可调用该方法。 + 只有 ``SparseCsrTensor`` 才可调用该方法。 返回:输入 SparseCsrTensor 的非 0 元素的压缩行信息 @@ -3455,7 +3455,7 @@ cols() ::::::::: .. note:: - 只有 `SparseCsrTensor` 才可调用该方法。 + 只有 ``SparseCsrTensor`` 才可调用该方法。 返回:输入 SparseCsrTensor 的非 0 元素的列信息 @@ -3548,7 +3548,7 @@ to_sparse_csr() ::::::::: .. note:: - 只有 `DenseTensor` 、`SparseCooTensor` 才可调用该方法。 + 只有 ``DenseTensor`` 、``SparseCooTensor`` 才可调用该方法。 将输入 Tensor 转换为 SparseCsrTensor。 @@ -3689,7 +3689,7 @@ masked_fill(x, mask, value, name=None) masked_fill_(x, mask, value, name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_masked_fill` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_masked_fill` API,对输入 ``x`` 采用 Inplace 策略。 masked_scatter(x, mask, value, name=None) ::::::::: @@ -3702,7 +3702,7 @@ masked_scatter(x, mask, value, name=None) masked_scatter_(x, mask, value, name=None) ::::::::: -Inplace 版本的 :ref:`cn_api_paddle_masked_scatter` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_masked_scatter` API,对输入 ``x`` 采用 Inplace 策略。 atleast_1d(name=None) ::::::::: @@ -3751,7 +3751,7 @@ select_scatter(x, values, axis, index, name=None) slice_scatter(value, axes, starts, ends, strides, name=None) ::::::::: -沿着 `axes` 将 `value` 矩阵的值嵌入到 `x` 矩阵。返回一个新的 Tensor 而不是视图。 +沿着 ``axes`` 将 ``value`` 矩阵的值嵌入到 ``x`` 矩阵。返回一个新的 Tensor 而不是视图。 返回:计算后的 Tensor @@ -3773,7 +3773,7 @@ signbit(x, name=None) block_diag(inputs, name=None) ::::::::: -根据 `inputs` 创建对角矩阵。 +根据 ``inputs`` 创建对角矩阵。 返回:对角矩阵 Tensor。 diff --git a/docs/api/paddle/atleast_2d_cn.rst b/docs/api/paddle/atleast_2d_cn.rst index f66621cc098..d2695d622c3 100644 --- a/docs/api/paddle/atleast_2d_cn.rst +++ b/docs/api/paddle/atleast_2d_cn.rst @@ -7,7 +7,7 @@ atleast_2d 将输入转换为张量并返回至少为 ``2`` 维的视图。 ``2`` 维或更高维的输入会被保留。 -下图分别展示了 `atleast_2d` 在不同数据类型下,对 1 个 `0` 维张量输入、1 个 `0` 维张量输入和 1 个 `1` 维张量输入,以及 1 个 `0` 维张量输入和 1 个 `3` 维张量输入,将其返回为至少为 `2` 维视图的张量或张量 list 的情形。 +下图分别展示了 ``atleast_2d`` 在不同数据类型下,对 1 个 ``0`` 维张量输入、1 个 ``0`` 维张量输入和 1 个 ``1`` 维张量输入,以及 1 个 ``0`` 维张量输入和 1 个 ``3`` 维张量输入,将其返回为至少为 ``2`` 维视图的张量或张量 list 的情形。 .. image:: ../../images/api_legend/atleast_2d.png :width: 600 diff --git a/docs/api/paddle/cdist_cn.rst b/docs/api/paddle/cdist_cn.rst index 4124d3a393f..7cac44f1f95 100644 --- a/docs/api/paddle/cdist_cn.rst +++ b/docs/api/paddle/cdist_cn.rst @@ -7,9 +7,9 @@ cdist 计算两组输入集合中每对之间的 p 范数距离。 -当 :math:`p \in (0, \infty)` 时,该函数等同于 `scipy.spatial.distance.cdist(input,'minkowski', p=p)` ; -当 :math:`p = 0` 时,等同于 `scipy.spatial.distance.cdist(input, 'hamming') * M` ; -当 :math:`p = \infty` 时,最接近的是 `scipy.spatial.distance.cdist(xn, lambda x, y: np.abs(x - y).max())` 。 +当 :math:`p \in (0, \infty)` 时,该函数等同于 ``scipy.spatial.distance.cdist(input,'minkowski', p=p)`` ; +当 :math:`p = 0` 时,等同于 ``scipy.spatial.distance.cdist(input, 'hamming') * M`` ; +当 :math:`p = \infty` 时,最接近的是 ``scipy.spatial.distance.cdist(xn, lambda x, y: np.abs(x - y).max())`` 。 参数 :::::::::::: @@ -28,7 +28,7 @@ cdist 返回 :::::::::::: -Tensor,`dtype` 与输入张量相同。 +Tensor,``dtype`` 与输入张量相同。 如果 x 的形状为 :math:`B \times P \times M`,y 的形状为 :math:`B \times R \times M`,则输出的形状为 :math:`B \times P \times R`。 代码示例 diff --git a/docs/api/paddle/combinations_cn.rst b/docs/api/paddle/combinations_cn.rst index 92f06d6942b..ceb4733e1ba 100644 --- a/docs/api/paddle/combinations_cn.rst +++ b/docs/api/paddle/combinations_cn.rst @@ -5,8 +5,8 @@ combinations .. py:function:: paddle.combinations(x, r=2, with_replacement=False, name=None) -对输入 Tensor 计算长度为 r 的情况下的所有组合,当 `with_replacement` 设为 False,可类比 python 内置 API `itertools.combinations` 。 -当 `with_replacement` 设为 True,可类比 python 内置 API `itertools.combinations_with_replacement(with_replacement=True)`。 +对输入 Tensor 计算长度为 r 的情况下的所有组合,当 ``with_replacement`` 设为 False,可类比 python 内置 API ``itertools.combinations`` 。 +当 ``with_replacement`` 设为 True,可类比 python 内置 API ``itertools.combinations_with_replacement(with_replacement=True)``。 参数 :::::::::: diff --git a/docs/api/paddle/compat/Overview_cn.rst b/docs/api/paddle/compat/Overview_cn.rst index 0b9f0dd41fe..b084c0395b1 100644 --- a/docs/api/paddle/compat/Overview_cn.rst +++ b/docs/api/paddle/compat/Overview_cn.rst @@ -14,9 +14,9 @@ PyTorch 兼容函数 :header: "API 名称", "API 功能" :widths: 10, 30 - " :ref:`max ` ", "包含 `amax`、同时返回 values 及 indices 的轴向最大值、`maximum` 三种功能" + " :ref:`max ` ", "包含 ``amax``、同时返回 values 及 indices 的轴向最大值、``maximum`` 三种功能" " :ref:`median ` ", "兼容版中位数,支持 dim/keepdim/out 签名" - " :ref:`min ` ", "包含 `amin`、同时返回 values 及 indices 的轴向最小值、`minimum` 三种功能" + " :ref:`min ` ", "包含 ``amin``、同时返回 values 及 indices 的轴向最小值、``minimum`` 三种功能" " :ref:`nanmedian ` ", "忽略 NaN 的兼容版中位数,支持 dim/keepdim/out 签名" " :ref:`slogdet ` ", "slogdet 函数" " :ref:`sort ` ", "同时返回 values 及 indices 的排序" diff --git a/docs/api/paddle/diagonal_cn.rst b/docs/api/paddle/diagonal_cn.rst index 8293da23b9d..fb44704f7dc 100644 --- a/docs/api/paddle/diagonal_cn.rst +++ b/docs/api/paddle/diagonal_cn.rst @@ -6,13 +6,13 @@ diagonal .. py:function:: paddle.diagonal(x, offset=0, axis1=0, axis2=1, name=None) -根据参数 `offset`、`axis1`、`axis2`,返回输入 `Tensor` 的局部视图。 +根据参数 ``offset``、``axis1``、``axis2``,返回输入 ``Tensor`` 的局部视图。 如果输入是 2D Tensor,则返回对角线元素。 如果输入的维度大于 2D,则返回由对角线元素组成的数组,其中对角线从由 axis1 和 axis2 指定的二维平面中获得。默认由输入的前两维组成获得对角线的 2D 平面。 -参数 `offset` 确定从指定的二维平面中获取对角线的位置: +参数 ``offset`` 确定从指定的二维平面中获取对角线的位置: - 如果 offset = 0,则取主对角线。 - 如果 offset > 0,则取主对角线右上的对角线。 diff --git a/docs/api/paddle/distributed/fleet/Fleet_cn.rst b/docs/api/paddle/distributed/fleet/Fleet_cn.rst index 32a6ee9c288..2f01c518f5e 100644 --- a/docs/api/paddle/distributed/fleet/Fleet_cn.rst +++ b/docs/api/paddle/distributed/fleet/Fleet_cn.rst @@ -58,7 +58,7 @@ COPY-FROM: paddle.distributed.fleet.Fleet.init:code-init-example4 is_first_worker() ''''''''' -返回当前节点是否为第一个`worker`节点,判断当前 worker_index 是否为 0,如果为 0 则返回 True,否则返回 False。 +返回当前节点是否为第一个 ``worker`` 节点,判断当前 worker_index 是否为 0,如果为 0 则返回 True,否则返回 False。 **返回** True/False @@ -71,7 +71,7 @@ COPY-FROM: paddle.distributed.fleet.Fleet.is_first_worker worker_index() ''''''''' -返回当前节点的编号,每个`worker`节点被分配[0, worker_num-1]内的唯一的编码 ID +返回当前节点的编号,每个 ``worker`` 节点被分配[0, worker_num-1]内的唯一的编码 ID **返回** int @@ -85,7 +85,7 @@ COPY-FROM: paddle.distributed.fleet.Fleet.worker_index worker_num() ''''''''' -返回当前全部训练节点中`worker`节点的个数 +返回当前全部训练节点中 ``worker`` 节点的个数 **返回** int @@ -98,7 +98,7 @@ COPY-FROM: paddle.distributed.fleet.Fleet.worker_num is_worker() ''''''''' -返回当前节点是否为`worker`节点 +返回当前节点是否为 ``worker`` 节点 **返回** True/False @@ -148,7 +148,7 @@ server_index() **该参数只在 ParameterServer 模式下生效** -返回当前节点的编号,每个`server`节点被分配[0, server_num-1]内的唯一的编码 ID +返回当前节点的编号,每个 ``server`` 节点被分配[0, server_num-1]内的唯一的编码 ID **返回** int @@ -187,7 +187,7 @@ is_server() **该参数只在 ParameterServer 模式下生效** -返回当前节点是否为`server`节点 +返回当前节点是否为 ``server`` 节点 **返回** True/False diff --git a/docs/api/paddle/distributed/fleet/utils/HDFSClient_cn.rst b/docs/api/paddle/distributed/fleet/utils/HDFSClient_cn.rst index ea74f2ae4f2..c3ca1285b3c 100644 --- a/docs/api/paddle/distributed/fleet/utils/HDFSClient_cn.rst +++ b/docs/api/paddle/distributed/fleet/utils/HDFSClient_cn.rst @@ -30,7 +30,7 @@ HDFSClient :::::::::::: ls_dir(fs_path) ''''''''' -列出 `fs_path` 路径下所有的文件和子目录。 +列出 ``fs_path`` 路径下所有的文件和子目录。 **参数** @@ -105,7 +105,7 @@ is_file(fs_path) **返回** - - Bool:若当前路径存在且是一个文件,返回 `True`,反之则返回 `False` 。 + - Bool:若当前路径存在且是一个文件,返回 ``True``,反之则返回 ``False`` 。 **代码示例** @@ -130,7 +130,7 @@ is_dir(fs_path) **返回** - - Bool:若当前路径存在且是一个目录,返回 `True`,反之则返回 `False` 。 + - Bool:若当前路径存在且是一个目录,返回 ``True``,反之则返回 ``False`` 。 **代码示例** @@ -155,7 +155,7 @@ is_exist(fs_path) **返回** - - Bool:若当前路径存在返回 `True`,反之则返回 `False` 。 + - Bool:若当前路径存在返回 ``True``,反之则返回 ``False`` 。 **代码示例** @@ -222,7 +222,7 @@ touch(fs_path, exist_ok=True) **参数** - **fs_path** (str): HADOOP 文件路径。 - - **exist_ok** (bool):路径已存在时程序是否报错。若 `exist_ok = True`,则直接返回,反之则抛出文件存在的异常,默认不抛出异常。 + - **exist_ok** (bool):路径已存在时程序是否报错。若 ``exist_ok = True``,则直接返回,反之则抛出文件存在的异常,默认不抛出异常。 **代码示例** diff --git a/docs/api/paddle/distributed/fleet/utils/LocalFS_cn.rst b/docs/api/paddle/distributed/fleet/utils/LocalFS_cn.rst index 709764ede91..e959a4ac2c3 100644 --- a/docs/api/paddle/distributed/fleet/utils/LocalFS_cn.rst +++ b/docs/api/paddle/distributed/fleet/utils/LocalFS_cn.rst @@ -15,7 +15,7 @@ COPY-FROM: paddle.distributed.fleet.utils.LocalFS :::::::::::: ls_dir(fs_path) ''''''''' -列出 `fs_path` 路径下所有的文件和子目录。 +列出 ``fs_path`` 路径下所有的文件和子目录。 **参数** @@ -76,7 +76,7 @@ is_file(fs_path) **返回** - - Bool:若当前路径存在且是一个文件,返回 `True`,反之则返回 `False` 。 + - Bool:若当前路径存在且是一个文件,返回 ``True``,反之则返回 ``False`` 。 **代码示例** @@ -92,7 +92,7 @@ is_dir(fs_path) **返回** - - Bool:若当前路径存在且是一个目录,返回 `True`,反之则返回 `False` 。 + - Bool:若当前路径存在且是一个目录,返回 ``True``,反之则返回 ``False`` 。 **代码示例** @@ -108,7 +108,7 @@ is_exist(fs_path) **返回** - - Bool:若当前路径存在返回 `True`,反之则返回 `False` 。 + - Bool:若当前路径存在返回 ``True``,反之则返回 ``False`` 。 **代码示例** @@ -121,7 +121,7 @@ touch(fs_path, exist_ok=True) **参数** - **fs_path** (str):本地文件路径。 - - **exist_ok** (bool):文件路径已存在时程序是否报错。若 `exist_ok = True`,则直接返回,反之则抛出文件存在的异常,默认不抛出异常。 + - **exist_ok** (bool):文件路径已存在时程序是否报错。若 ``exist_ok = True``,则直接返回,反之则抛出文件存在的异常,默认不抛出异常。 **代码示例** diff --git a/docs/api/paddle/distributed/shard_layer_cn.rst b/docs/api/paddle/distributed/shard_layer_cn.rst index 06783383805..356d354e577 100644 --- a/docs/api/paddle/distributed/shard_layer_cn.rst +++ b/docs/api/paddle/distributed/shard_layer_cn.rst @@ -5,13 +5,13 @@ shard_layer .. py:function:: paddle.distributed.shard_layer(layer, process_mesh, shard_fn=None, input_fn=None, output_fn=None) -根据参数 `shard_fn` 将传入的 `paddle.nn.Layer` 所有的参数转换为带有分布式切分信息的 `Tensor`。同时也支持指定 `input_fn` 和 `output_fn` 用于控制输入和输出 `Tensor` 的转换。(具体指的是,将输入转换为带有分布式切分信息的 `Tensor`,将输出转回不带分布式切分信息的 `Tensor`。) +根据参数 ``shard_fn`` 将传入的 ``paddle.nn.Layer`` 所有的参数转换为带有分布式切分信息的 ``Tensor``。同时也支持指定 ``input_fn`` 和 ``output_fn`` 用于控制输入和输出 ``Tensor`` 的转换。(具体指的是,将输入转换为带有分布式切分信息的 ``Tensor``,将输出转回不带分布式切分信息的 ``Tensor``。) -`shard_fn` 的函数签名为:def shard_fn(layer_name, layer, process_mesh) -> None。 +``shard_fn`` 的函数签名为:def shard_fn(layer_name, layer, process_mesh) -> None。 -`input_fn` 的函数签名为:def input_fn(inputs, process_mesh) -> list(paddle.Tensor),一般地,`input_fn` 返回值的类型为带有分布式切分信息的 `Tensor`。 +``input_fn`` 的函数签名为:def input_fn(inputs, process_mesh) -> list(paddle.Tensor),一般地,``input_fn`` 返回值的类型为带有分布式切分信息的 ``Tensor``。 -`output_fn` 的函数签名为:def output_fn(outputs, process_mesh) -> list(paddle.Tensor),一般地,`output_fn` 返回值的类型为不带分布式切分信息的 `Tensor`。 +``output_fn`` 的函数签名为:def output_fn(outputs, process_mesh) -> list(paddle.Tensor),一般地,``output_fn`` 返回值的类型为不带分布式切分信息的 ``Tensor``。 参数 @@ -25,7 +25,7 @@ shard_layer 返回 ::::::::: -Layer:一个参数全部为带有分布式切分信息 `Tensor` 的 `Layer` 对象。 +Layer:一个参数全部为带有分布式切分信息 ``Tensor`` 的 ``Layer`` 对象。 代码示例 diff --git a/docs/api/paddle/distribution/ContinuousBernoulli_cn.rst b/docs/api/paddle/distribution/ContinuousBernoulli_cn.rst index ac7c8051c35..a1bd5ce6306 100644 --- a/docs/api/paddle/distribution/ContinuousBernoulli_cn.rst +++ b/docs/api/paddle/distribution/ContinuousBernoulli_cn.rst @@ -79,7 +79,7 @@ prob(value) **返回** -Tensor,:attr:`value` 的概率。数据类型与 `self.probs` 相同。 +Tensor,:attr:`value` 的概率。数据类型与 ``self.probs`` 相同。 log_prob(value) @@ -93,7 +93,7 @@ log_prob(value) **返回** -Tensor,:attr:`value` 的对数概率。数据类型与 `self.probs` 相同。 +Tensor,:attr:`value` 的对数概率。数据类型与 ``self.probs`` 相同。 cdf(value) @@ -118,7 +118,7 @@ cdf(value) **返回** -Tensor: :attr:`value` 的累积分布函数对应的 quantile 值。数据类型与 `self.probs` 相同。 +Tensor: :attr:`value` 的累积分布函数对应的 quantile 值。数据类型与 ``self.probs`` 相同。 icdf(value) @@ -142,7 +142,7 @@ icdf(value) **返回** -Tensor,ContinuousBernoulli 随机变量在对应 quantile 下的值。数据类型与 `self.probs` 相同。 +Tensor,ContinuousBernoulli 随机变量在对应 quantile 下的值。数据类型与 ``self.probs`` 相同。 sample(shape=[]) diff --git a/docs/api/paddle/distribution/MultivariateNormal_cn.rst b/docs/api/paddle/distribution/MultivariateNormal_cn.rst index 24cb8637cf4..5969ea9c8b3 100644 --- a/docs/api/paddle/distribution/MultivariateNormal_cn.rst +++ b/docs/api/paddle/distribution/MultivariateNormal_cn.rst @@ -74,7 +74,7 @@ prob(value) **返回** -Tensor,:attr:`value` 的概率。数据类型与 `self.loc` 相同。 +Tensor,:attr:`value` 的概率。数据类型与 ``self.loc`` 相同。 log_prob(value) @@ -88,7 +88,7 @@ log_prob(value) **返回** -Tensor,:attr:`value` 的对数概率。数据类型与 `self.loc` 相同。 +Tensor,:attr:`value` 的对数概率。数据类型与 ``self.loc`` 相同。 sample(shape=[]) @@ -102,7 +102,7 @@ sample(shape=[]) **返回** -Tensor,样本数据。其维度为 :math:`\text{sample shape} + \text{batch shape} + \text{event shape}` 。数据类型与 `self.loc` 相同。 +Tensor,样本数据。其维度为 :math:`\text{sample shape} + \text{batch shape} + \text{event shape}` 。数据类型与 ``self.loc`` 相同。 rsample(shape=[]) @@ -116,7 +116,7 @@ rsample(shape=[]) **返回** -Tensor,样本数据。其维度为 :math:`\text{sample shape} + \text{batch shape} + \text{event shape}` 。数据类型与 `self.loc` 相同。 +Tensor,样本数据。其维度为 :math:`\text{sample shape} + \text{batch shape} + \text{event shape}` 。数据类型与 ``self.loc`` 相同。 entropy() @@ -130,7 +130,7 @@ entropy() **返回** -多元正态分布的信息熵,数据类型与 `self.loc` 相同。 +多元正态分布的信息熵,数据类型与 ``self.loc`` 相同。 kl_divergence(other) @@ -148,4 +148,4 @@ kl_divergence(other) **返回** -相对于另一个多元正态分布的 KL 散度,数据类型与 `self.loc` 相同。 +相对于另一个多元正态分布的 KL 散度,数据类型与 ``self.loc`` 相同。 diff --git a/docs/api/paddle/einsum_cn.rst b/docs/api/paddle/einsum_cn.rst index a74a06ea1d9..4e27b7e41f4 100644 --- a/docs/api/paddle/einsum_cn.rst +++ b/docs/api/paddle/einsum_cn.rst @@ -29,15 +29,15 @@ Einstein 求和是一种采用 Einstein 标记法描述的 Tensor 求和,输 **关于求和标记的约定** - 维度分量下标:Tensor 的维度分量下标使用英文字母表示,不区分大小写,如'ijk'表示 Tensor 维度分量为 i,j,k - - 下标对应输入操作数:维度下标以`,`分段,按顺序 1-1 对应输入操作数 - - 广播维度:省略号`...`表示维度的广播分量,例如,'i...j'表示首末分量除外的维度需进行广播对齐 + - 下标对应输入操作数:维度下标以 ``,`` 分段,按顺序 1-1 对应输入操作数 + - 广播维度:省略号 ``...`` 表示维度的广播分量,例如,'i...j'表示首末分量除外的维度需进行广播对齐 - 自由标和哑标:输入标记中仅出现一次的下标为自由标,重复出现的下标为哑标,哑标对应的维度分量将被规约消去 - 输出:输出 Tensor 的维度分量既可由输入标记自动推导,也可以用输出标记定制化 - 自动推导输出 - 广播维度分量位于维度向量高维位置,自由标维度分量按字母顺序排序,位于维度向量低纬位置,哑标维度分量不输出 - 定制化输出 - - 维度标记中`->`右侧为输出标记 - - 若输出包含广播维度,则输出标记需包含`...` + - 维度标记中 ``->`` 右侧为输出标记 + - 若输出包含广播维度,则输出标记需包含 ``...`` - 输出标记为空时,对输出进行全量求和,返回该标量 - 输出不能包含输入标记中未出现的下标 - 输出下标不可以重复出现 diff --git a/docs/api/paddle/grad_cn.rst b/docs/api/paddle/grad_cn.rst index a71d1322e2e..fe13c40cfbc 100644 --- a/docs/api/paddle/grad_cn.rst +++ b/docs/api/paddle/grad_cn.rst @@ -9,7 +9,7 @@ grad .. note:: 该 API 仅支持 **动态图模式**。 -对于每个 `inputs`,计算所有 `outputs` 相对于其的梯度和。 +对于每个 ``inputs``,计算所有 ``outputs`` 相对于其的梯度和。 参数 ::::::::: @@ -26,7 +26,7 @@ grad 返回 ::::::::: -tuple(Tensor),其长度等于 `inputs` 中的变量个数,且第 i 个返回的变量是所有 `outputs` 相对于第 i 个 `inputs` 的梯度之和。 +tuple(Tensor),其长度等于 ``inputs`` 中的变量个数,且第 i 个返回的变量是所有 ``outputs`` 相对于第 i 个 ``inputs`` 的梯度之和。 代码示例 1 ::::::::: diff --git a/docs/api/paddle/incubate/asp/prune_model_cn.rst b/docs/api/paddle/incubate/asp/prune_model_cn.rst index f38a2e9ddc4..d724eca2cae 100644 --- a/docs/api/paddle/incubate/asp/prune_model_cn.rst +++ b/docs/api/paddle/incubate/asp/prune_model_cn.rst @@ -6,10 +6,10 @@ prune_model .. py:function:: paddle.incubate.asp.prune_model(model, n=2, m=4, mask_algo='mask_1d', with_mask=True) -使用 `mask_algo` 指定的掩码生成函数裁剪 model 中支持 ASP(Auto SParsity) 的子层参数。支持训练和推理,并由 `with_mask` 参数控制。如果 with_mask 是 True ,则还会裁剪与参数相关的 ASP 掩码变量,如果是 False,则仅裁剪参数本身。 +使用 ``mask_algo`` 指定的掩码生成函数裁剪 model 中支持 ASP(Auto SParsity) 的子层参数。支持训练和推理,并由 ``with_mask`` 参数控制。如果 with_mask 是 True ,则还会裁剪与参数相关的 ASP 掩码变量,如果是 False,则仅裁剪参数本身。 .. note:: - - 在静态图模式下,使用 `with_mask` 调用函数时,需要先调用 OptimizerWithSparsityGuarantee.minimize 和 exe.run(startup_program) 来成功获取掩码变量。通常情况下训练时(已调用 OptimizerWithSparsityGuarantee.minimize)设置 `with_mask` 为 True。而仅进行推理时,设置 `with_mask` 为 False。 获取 OptimizerWithSparsityGuarantee 请参考 :ref:`paddle.incubate.asp.decorate `。 + - 在静态图模式下,使用 ``with_mask`` 调用函数时,需要先调用 OptimizerWithSparsityGuarantee.minimize 和 exe.run(startup_program) 来成功获取掩码变量。通常情况下训练时(已调用 OptimizerWithSparsityGuarantee.minimize)设置 ``with_mask`` 为 True。而仅进行推理时,设置 ``with_mask`` 为 False。 获取 OptimizerWithSparsityGuarantee 请参考 :ref:`paddle.incubate.asp.decorate `。 - 在动态图模式下,使用 with_mask 调用函数时,需要先调用 :ref:`paddle.incubate.asp.decorate ` 来获取掩码变量。 diff --git a/docs/api/paddle/incubate/identity_loss_cn.rst b/docs/api/paddle/incubate/identity_loss_cn.rst index 70395c351cd..32b7da0661e 100644 --- a/docs/api/paddle/incubate/identity_loss_cn.rst +++ b/docs/api/paddle/incubate/identity_loss_cn.rst @@ -8,14 +8,14 @@ identity_loss 用于在 IPU 动态图转静态图功能中标记网络的损失值,从而能够在 IPU 上为网络添加反向计算过程。算子以网络的损失值作为输入,并对输入做 reduction: -当 `reduction` 为 `none` 时,直接返回最原始的 `Out` 结果。 +当 ``reduction`` 为 ``none`` 时,直接返回最原始的 ``Out`` 结果。 -当 `reduction` 为 `mean` 时,最终的输出结果为: +当 ``reduction`` 为 ``mean`` 时,最终的输出结果为: .. math:: Out = MEAN(Out) -当 `reduction` 为 `sum` 时,最终的输出结果为: +当 ``reduction`` 为 ``sum`` 时,最终的输出结果为: .. math:: Out = SUM(Out) @@ -28,7 +28,7 @@ identity_loss 返回 :::::::::::: -Variable,根据 `reduction` 返回网络损失值的计算结果。 +Variable,根据 ``reduction`` 返回网络损失值的计算结果。 代码示例 :::::::::::: diff --git a/docs/api/paddle/linalg/cholesky_inverse_cn.rst b/docs/api/paddle/linalg/cholesky_inverse_cn.rst index 1ab78f917d6..0aa6f5b1cdf 100644 --- a/docs/api/paddle/linalg/cholesky_inverse_cn.rst +++ b/docs/api/paddle/linalg/cholesky_inverse_cn.rst @@ -5,14 +5,14 @@ cholesky_inverse .. py:function:: paddle.linalg.cholesky_inverse(x, upper=False, name=None) -使用 Cholesky 因子 `U` 计算对称正定矩阵的逆矩阵,返回矩阵 `inv`。 -如果 `upper` 是 `False`,则 `U` 为下三角矩阵: +使用 Cholesky 因子 ``U`` 计算对称正定矩阵的逆矩阵,返回矩阵 ``inv``。 +如果 ``upper`` 是 ``False``,则 ``U`` 为下三角矩阵: .. math:: inv = (UU^{T})^{-1} -如果 `upper` 是 `True`,则 `U` 为上三角矩阵: +如果 ``upper`` 是 ``True``,则 ``U`` 为上三角矩阵: .. math:: diff --git a/docs/api/paddle/linalg/corrcoef_cn.rst b/docs/api/paddle/linalg/corrcoef_cn.rst index 4f840b33692..b2d688742b6 100644 --- a/docs/api/paddle/linalg/corrcoef_cn.rst +++ b/docs/api/paddle/linalg/corrcoef_cn.rst @@ -7,13 +7,13 @@ corrcoef 相关系数矩阵表示输入矩阵中每对变量的相关性。例如,对于 N 维样本 X=[x1,x2,…xN]T,则相关系数矩阵 -元素 `Rij` 是 `xi` 和 `xj` 的相关性。元素 `Rii` 是 `xi` 本身的协方差。 +元素 ``Rij`` 是 ``xi`` 和 ``xj`` 的相关性。元素 ``Rii`` 是 ``xi`` 本身的协方差。 -皮尔逊积矩相关系数 `R` 和协方差矩阵 `C` 的关系如下: +皮尔逊积矩相关系数 ``R`` 和协方差矩阵 ``C`` 的关系如下: .. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} * C_{jj} } } - `R` 的值在-1 到 1 之间。 + ``R`` 的值在-1 到 1 之间。 参数 ::::::::: diff --git a/docs/api/paddle/linalg/householder_product_cn.rst b/docs/api/paddle/linalg/householder_product_cn.rst index 7d4bc6ac0c0..3c8e112e0b5 100644 --- a/docs/api/paddle/linalg/householder_product_cn.rst +++ b/docs/api/paddle/linalg/householder_product_cn.rst @@ -6,11 +6,11 @@ householder_product .. py:function:: paddle.linalg.householder_product(x, tau, name=None) -计算 Householder 矩阵乘积的前 n 列(输入矩阵为 `[*,m,n]` )。 +计算 Householder 矩阵乘积的前 n 列(输入矩阵为 ``[*,m,n]`` )。 -该函数可以从矩阵 `x` (m x n) 得到向量 :math:`\omega_{i}`,其中前 `i-1` 个元素为零,第 i 个元素为 `1`,其余元素元素来自 `x` 的第 i 列。 -并且使用向量 `tau` 可以计算 Householder 矩阵乘积的前 n 列。 +该函数可以从矩阵 ``x`` (m x n) 得到向量 :math:`\omega_{i}`,其中前 ``i-1`` 个元素为零,第 i 个元素为 ``1``,其余元素元素来自 ``x`` 的第 i 列。 +并且使用向量 ``tau`` 可以计算 Householder 矩阵乘积的前 n 列。 .. math:: H_i = I_m - \tau_i \omega_i \omega_i^H diff --git a/docs/api/paddle/linalg/lu_solve_cn.rst b/docs/api/paddle/linalg/lu_solve_cn.rst index 5419c168ecf..d5ce34506b4 100644 --- a/docs/api/paddle/linalg/lu_solve_cn.rst +++ b/docs/api/paddle/linalg/lu_solve_cn.rst @@ -5,26 +5,26 @@ lu_solve .. py:function:: paddle.linalg.lu_solve(b, lu, pivots, trans="N", name=None) -给定 `A` 的 LU 分解结果 和列向量 `b` ,求解线性方程组的解 `x`。 +给定 ``A`` 的 LU 分解结果 和列向量 ``b`` ,求解线性方程组的解 ``x``。 -记 :math:`A` 为一个或一批方阵,:math:`b` 一个或一批矩阵,当 `trans` 为 `N` 时,公式为: +记 :math:`A` 为一个或一批方阵,:math:`b` 一个或一批矩阵,当 ``trans`` 为 ``N`` 时,公式为: .. math:: b = A * X -当 `trans` 为 `T` 时,公式为: +当 ``trans`` 为 ``T`` 时,公式为: .. math:: b = A ^ {T} * X -当 `trans` 为 `C` 时,公式为: +当 ``trans`` 为 ``C`` 时,公式为: .. math:: b = A ^ {H} * X .. note:: - `lu` 和 `pivots` 由 ``paddle.linalg.lu`` 得到。 + ``lu`` 和 ``pivots`` 由 ``paddle.linalg.lu`` 得到。 参数 :::::::::::: diff --git a/docs/api/paddle/linalg/matrix_transpose_cn.rst b/docs/api/paddle/linalg/matrix_transpose_cn.rst index ca3a57facb0..7559aa8b6ca 100644 --- a/docs/api/paddle/linalg/matrix_transpose_cn.rst +++ b/docs/api/paddle/linalg/matrix_transpose_cn.rst @@ -5,10 +5,10 @@ matrix_transpose .. py:function:: paddle.linalg.matrix_transpose(x, name=None) -对输入张量 `x` 的最后两个维度进行转置。 +对输入张量 ``x`` 的最后两个维度进行转置。 .. note:: - 如果 `n` 是 `x` 的维数,则 `paddle.linalg.matrix_transpose(x)` 等同于 `x.transpose([0, 1, ..., n-2, n-1])` 。 + 如果 ``n`` 是 ``x`` 的维数,则 ``paddle.linalg.matrix_transpose(x)`` 等同于 ``x.transpose([0, 1, ..., n-2, n-1])`` 。 参数 :::::::::::: diff --git a/docs/api/paddle/matrix_transpose_cn.rst b/docs/api/paddle/matrix_transpose_cn.rst index a2b2dc2f197..dd0123ddc4c 100644 --- a/docs/api/paddle/matrix_transpose_cn.rst +++ b/docs/api/paddle/matrix_transpose_cn.rst @@ -5,10 +5,10 @@ matrix_transpose .. py:function:: paddle.matrix_transpose(x, name=None) -对输入张量 `x` 的最后两个维度进行转置。 +对输入张量 ``x`` 的最后两个维度进行转置。 .. note:: - 如果 `n` 是 `x` 的维数,则 `paddle.matrix_transpose(x)` 等同于 `x.transpose([0, 1, ..., n-2, n-1])` 。 + 如果 ``n`` 是 ``x`` 的维数,则 ``paddle.matrix_transpose(x)`` 等同于 ``x.transpose([0, 1, ..., n-2, n-1])`` 。 参数 :::::::::::: diff --git a/docs/api/paddle/metric/Metric_cn.rst b/docs/api/paddle/metric/Metric_cn.rst index 2c1e1ee34a5..fee41e1ad93 100644 --- a/docs/api/paddle/metric/Metric_cn.rst +++ b/docs/api/paddle/metric/Metric_cn.rst @@ -17,13 +17,13 @@ Metric m.update(prediction, label) m.accumulate() -`compute` 接口的进阶用法: +``compute`` 接口的进阶用法: -在 `compute` 中可以使用 PaddlePaddle 内置的算子进行评估器的状态,而不是通过 -Python/NumPy,这样可以加速计算。`update` 接口将 `compute` 的输出作为 +在 ``compute`` 中可以使用 PaddlePaddle 内置的算子进行评估器的状态,而不是通过 +Python/NumPy,这样可以加速计算。``update`` 接口将 ``compute`` 的输出作为 输入,内部采用 Python/NumPy 计算。 -`Metric` 计算流程如下 (在{}中的表示模型和评估器的计算): +``Metric`` 计算流程如下 (在{}中的表示模型和评估器的计算): .. code-block:: text @@ -46,9 +46,9 @@ Python/NumPy,这样可以加速计算。`update` 接口将 `compute` 的输出 代码示例 1 :::::::::::: -以 计算正确率的 `Accuracy` 为例,该评估器的输入为 `pred` 和 `label`,可以在 `compute` 中通过 `pred` 和 `label`先计算正确预测的矩阵。 -例如,预测结果包含 10 类,`pred` 的 shape 是[N, 10],`label` 的 shape 是[N, 1],N 是 batch size,我们需要计算 top-1 和 top-5 的准确率, -可以在 `compute` 中计算每个样本的 top-5 得分,正确预测的矩阵的 shape 是[N, 5]。 +以 计算正确率的 ``Accuracy`` 为例,该评估器的输入为 ``pred`` 和 ``label``,可以在 ``compute`` 中通过 ``pred`` 和 ``label``先计算正确预测的矩阵。 +例如,预测结果包含 10 类,``pred`` 的 shape 是[N, 10],``label`` 的 shape 是[N, 1],N 是 batch size,我们需要计算 top-1 和 top-5 的准确率, +可以在 ``compute`` 中计算每个样本的 top-5 得分,正确预测的矩阵的 shape 是[N, 5]。 COPY-FROM: paddle.metric.Metric:code-compute-example @@ -56,7 +56,7 @@ COPY-FROM: paddle.metric.Metric:code-compute-example 代码示例 2 :::::::::::: -在 `compute` 中的计算,使用内置的算子(可以跑在 GPU 上,使得速度更快)。作为 `update` 的输入,该接口计算如下: +在 ``compute`` 中的计算,使用内置的算子(可以跑在 GPU 上,使得速度更快)。作为 ``update`` 的输入,该接口计算如下: COPY-FROM: paddle.metric.Metric:code-update-example @@ -75,10 +75,10 @@ reset() update(*args) ''''''''' -更新状态。如果定义了 `compute` , `update` 的输入是 `compute` 的输出。如果没有定义,则输入是网络的输出**output**和标签**label**, -如:`update(output1, output2, ..., label1, label2,...)` 。 +更新状态。如果定义了 ``compute`` , ``update`` 的输入是 ``compute`` 的输出。如果没有定义,则输入是网络的输出**output**和标签**label**, +如:``update(output1, output2, ..., label1, label2,...)`` 。 -也可以参考 `update` 。 +也可以参考 ``update`` 。 accumulate() @@ -106,7 +106,7 @@ compute() 此接口可以通过 PaddlePaddle 内置的算子计算 metric 的状态,可以加速 metric 的计算,为可选的高阶接口。 -- 如果这个接口定义了,输入是网络的输出 **outputs** 和 标签 **labels**,定义如:`compute(output1, output2, ..., label1, label2,...)` 。 -- 如果这个接口没有定义,默认的行为是直接将输入参数返回给 `update`,则其定义如:`update(output1, output2, ..., label1, label2,...)` 。 +- 如果这个接口定义了,输入是网络的输出 **outputs** 和 标签 **labels**,定义如:``compute(output1, output2, ..., label1, label2,...)`` 。 +- 如果这个接口没有定义,默认的行为是直接将输入参数返回给 ``update``,则其定义如:``update(output1, output2, ..., label1, label2,...)`` 。 -也可以参考 `compute` 。 +也可以参考 ``compute`` 。 diff --git a/docs/api/paddle/nn/BCEWithLogitsLoss_cn.rst b/docs/api/paddle/nn/BCEWithLogitsLoss_cn.rst index c5bbe8995dd..03fe7e340f7 100644 --- a/docs/api/paddle/nn/BCEWithLogitsLoss_cn.rst +++ b/docs/api/paddle/nn/BCEWithLogitsLoss_cn.rst @@ -5,9 +5,9 @@ BCEWithLogitsLoss .. py:class:: paddle.nn.BCEWithLogitsLoss(weight=None, reduction='mean', pos_weight=None, name=None) -可用于创建一个 BCEWithLogitsLoss 的可调用类,计算输入的预测值 `logit` 和标签 `label` 间的 `binary cross entropy with logits loss` 损失。 +可用于创建一个 BCEWithLogitsLoss 的可调用类,计算输入的预测值 ``logit`` 和标签 ``label`` 间的 ``binary cross entropy with logits loss`` 损失。 -计算方式结合了 `sigmoid` 操作和 :ref:`cn_api_paddle_nn_BCELoss` 操作。或者,我们也可以认为计算方式是 ``sigmoid_cross_entrop_with_logits`` 和一些 `reduce` 操作的组合。 +计算方式结合了 ``sigmoid`` 操作和 :ref:`cn_api_paddle_nn_BCELoss` 操作。或者,我们也可以认为计算方式是 ``sigmoid_cross_entrop_with_logits`` 和一些 ``reduce`` 操作的组合。 该损失函数衡量了在每个类别相互独立的分类任务中的逐元素概率误差。这可以被视为预测数据点的标签,其中标签不是相互排斥的。例如,一篇新闻文章可以同时关于政治,科技,体育或者同时不包含这些内容。 @@ -28,7 +28,7 @@ BCEWithLogitsLoss 然后,当 ``weight`` 或 ``pos_weight`` 不为 None 的时候,将会在输出 Out 上乘以相应的权重。Tensor ``weight`` 给 Batch 中的每一条数据赋予不同权重,Tensor ``pos_weight`` 给每一类的正例添加相应的权重。 -最后,将会添加 `reduce` 操作到前面的输出 Out 上。当 `reduction` 为 `none` 时,直接返回最原始的 `Out` 结果。当 `reduction` 为 `mean` 时,返回输出的均值 :math:`Out = MEAN(Out)`。当 `reduction` 为 `sum` 时,返回输出的求和 :math:`Out = SUM(Out)` 。 +最后,将会添加 ``reduce`` 操作到前面的输出 Out 上。当 ``reduction`` 为 ``none`` 时,直接返回最原始的 ``Out`` 结果。当 ``reduction`` 为 ``mean`` 时,返回输出的均值 :math:`Out = MEAN(Out)`。当 ``reduction`` 为 ``sum`` 时,返回输出的求和 :math:`Out = SUM(Out)` 。 .. note:: 因为是二分类任务,所以标签值应该是 0 或者 1。 diff --git a/docs/api/paddle/nn/BeamSearchDecoder_cn.rst b/docs/api/paddle/nn/BeamSearchDecoder_cn.rst index 6d17e85455f..9252cc9a9d0 100644 --- a/docs/api/paddle/nn/BeamSearchDecoder_cn.rst +++ b/docs/api/paddle/nn/BeamSearchDecoder_cn.rst @@ -27,7 +27,7 @@ BeamSearchDecoder 返回 :::::::::::: -BeamSearchDecoder 的一个实例,可以用于传入 `paddle.nn.dynamic\_decode` 以实现解码过程。 +BeamSearchDecoder 的一个实例,可以用于传入 ``paddle.nn.dynamic\_decode`` 以实现解码过程。 代码示例 :::::::::::: diff --git a/docs/api/paddle/nn/CTCLoss_cn.rst b/docs/api/paddle/nn/CTCLoss_cn.rst index 560016243b6..06990edd1cd 100644 --- a/docs/api/paddle/nn/CTCLoss_cn.rst +++ b/docs/api/paddle/nn/CTCLoss_cn.rst @@ -24,7 +24,7 @@ CTCLoss 返回 ::::::::: -``Tensor``,输入 ``log_probs`` 和标签 ``labels`` 间的 `ctc loss`。如果 :attr:`reduction` 是 ``'none'``,则输出 loss 的维度为 [batch_size]。如果 :attr:`reduction` 是 ``'mean'`` 或 ``'sum'``,则输出 Loss 的维度为 []。数据类型与输入的 ``log_probs`` 一致。 +``Tensor``,输入 ``log_probs`` 和标签 ``labels`` 间的 ``ctc loss``。如果 :attr:`reduction` 是 ``'none'``,则输出 loss 的维度为 [batch_size]。如果 :attr:`reduction` 是 ``'mean'`` 或 ``'sum'``,则输出 Loss 的维度为 []。数据类型与输入的 ``log_probs`` 一致。 代码示例 ::::::::: diff --git a/docs/api/paddle/nn/CosineEmbeddingLoss_cn.rst b/docs/api/paddle/nn/CosineEmbeddingLoss_cn.rst index e9d3eb4e063..0a00c554b7f 100644 --- a/docs/api/paddle/nn/CosineEmbeddingLoss_cn.rst +++ b/docs/api/paddle/nn/CosineEmbeddingLoss_cn.rst @@ -5,7 +5,7 @@ CosineEmbeddingLoss .. py:class:: paddle.nn.CosineEmbeddingLoss(margin=0, reduction='mean', name=None) -该函数计算给定的输入 input1, input2 和 label 之间的 `CosineEmbedding` 损失,通常用于学习非线性嵌入或半监督学习 +该函数计算给定的输入 input1, input2 和 label 之间的 ``CosineEmbedding`` 损失,通常用于学习非线性嵌入或半监督学习 如果 label=1,则该损失函数的数学计算公式如下: diff --git a/docs/api/paddle/nn/Fold_cn.rst b/docs/api/paddle/nn/Fold_cn.rst index b52ad8a09f8..7aa0ee95bbd 100644 --- a/docs/api/paddle/nn/Fold_cn.rst +++ b/docs/api/paddle/nn/Fold_cn.rst @@ -16,7 +16,7 @@ Fold C_{out} &= \frac{C_{in}}{kernel\_sizes[0]\times kernel\_sizes[1]} \\ .. note:: - 对应的 `functional 方法` 请参考::ref:`cn_api_paddle_nn_functional_fold` 。 + 对应的 ``functional 方法`` 请参考::ref:`cn_api_paddle_nn_functional_fold` 。 diff --git a/docs/api/paddle/nn/Hardsigmoid_cn.rst b/docs/api/paddle/nn/Hardsigmoid_cn.rst index e6f703f9176..bae3b0144ce 100644 --- a/docs/api/paddle/nn/Hardsigmoid_cn.rst +++ b/docs/api/paddle/nn/Hardsigmoid_cn.rst @@ -5,7 +5,7 @@ Hardsigmoid .. py:class:: paddle.nn.Hardsigmoid(name=None) -Hardsigmoid 激活层,用于创建一个 `Hardsigmoid` 类的可调用对象。sigmoid 的分段线性逼近激活函数,速度比 sigmoid 快,详细解释参见 `Noisy Activation Functions `_ 。 +Hardsigmoid 激活层,用于创建一个 ``Hardsigmoid`` 类的可调用对象。sigmoid 的分段线性逼近激活函数,速度比 sigmoid 快,详细解释参见 `Noisy Activation Functions `_ 。 .. math:: diff --git a/docs/api/paddle/nn/Hardswish_cn.rst b/docs/api/paddle/nn/Hardswish_cn.rst index 3ddad13a0c9..ecd7f5f4ceb 100644 --- a/docs/api/paddle/nn/Hardswish_cn.rst +++ b/docs/api/paddle/nn/Hardswish_cn.rst @@ -5,7 +5,7 @@ Hardswish .. py:class:: paddle.nn.Hardswish(name=None) -Hardswish 激活函数。创建一个 `Hardswish` 类的可调用对象。在 MobileNetV3 架构中被提出,相较于 :ref:`cn_api_paddle_nn_Swish` 函数,具有数值稳定性好,计算速度快等优点,具体原理请参考:`Searching for MobileNetV3 `_ 。 +Hardswish 激活函数。创建一个 ``Hardswish`` 类的可调用对象。在 MobileNetV3 架构中被提出,相较于 :ref:`cn_api_paddle_nn_Swish` 函数,具有数值稳定性好,计算速度快等优点,具体原理请参考:`Searching for MobileNetV3 `_ 。 .. math:: diff --git a/docs/api/paddle/nn/HingeEmbeddingLoss_cn.rst b/docs/api/paddle/nn/HingeEmbeddingLoss_cn.rst index 0dd20405ca7..461a2f25165 100644 --- a/docs/api/paddle/nn/HingeEmbeddingLoss_cn.rst +++ b/docs/api/paddle/nn/HingeEmbeddingLoss_cn.rst @@ -5,7 +5,7 @@ HingeEmbeddingLoss .. py:class:: paddle.nn.HingeEmbeddingLoss(margin=1.0, reduction='mean', name=None) -创建一个 HingeEmbeddingLoss 的可调用类,HingeEmbeddingLoss 计算输入 input 和标签 label(包含 1 和 -1) 间的 `hinge embedding loss` 损失。 +创建一个 HingeEmbeddingLoss 的可调用类,HingeEmbeddingLoss 计算输入 input 和标签 label(包含 1 和 -1) 间的 ``hinge embedding loss`` 损失。 该损失通常用于度量输入 input 和标签 label 是否相似或不相似,例如可以使用 L1 成对距离作为输入 input,通常用于学习非线性嵌入或半监督学习。 diff --git a/docs/api/paddle/nn/KLDivLoss_cn.rst b/docs/api/paddle/nn/KLDivLoss_cn.rst index 388c5000a9b..42b2e8e94db 100644 --- a/docs/api/paddle/nn/KLDivLoss_cn.rst +++ b/docs/api/paddle/nn/KLDivLoss_cn.rst @@ -5,7 +5,7 @@ KLDivLoss .. py:class:: paddle.nn.KLDivLoss(reduction='mean', log_target=False) -创建一个 `KLDivLoss` 类的可调用对象,以计算输入(Input)和输入(Label)之间的 Kullback-Leibler 散度损失。注意其中输入(Input)应为对数概率值,输入(Label)应为概率值。 +创建一个 ``KLDivLoss`` 类的可调用对象,以计算输入(Input)和输入(Label)之间的 Kullback-Leibler 散度损失。注意其中输入(Input)应为对数概率值,输入(Label)应为概率值。 若 ``log_target`` 为 ``False``: diff --git a/docs/api/paddle/nn/L1Loss_cn.rst b/docs/api/paddle/nn/L1Loss_cn.rst index aaff39c17bb..59cc17d9d2a 100644 --- a/docs/api/paddle/nn/L1Loss_cn.rst +++ b/docs/api/paddle/nn/L1Loss_cn.rst @@ -5,21 +5,21 @@ L1Loss .. py:class:: paddle.nn.L1Loss(reduction='mean', name=None) -创建一个 L1Loss 的可调用类,L1Loss 计算输入 input 和标签 label 间的 `L1 loss` 损失。 +创建一个 L1Loss 的可调用类,L1Loss 计算输入 input 和标签 label 间的 ``L1 loss`` 损失。 该损失函数的数学计算公式如下: -当 `reduction` 设置为 ``'none'`` 时: +当 ``reduction`` 设置为 ``'none'`` 时: .. math:: Out = \lvert input - label\rvert -当 `reduction` 设置为 ``'mean'`` 时: +当 ``reduction`` 设置为 ``'mean'`` 时: .. math:: Out = MEAN(\lvert input - label\rvert) -当 `reduction` 设置为 ``'sum'`` 时: +当 ``reduction`` 设置为 ``'sum'`` 时: .. math:: Out = SUM(\lvert input - label\rvert) diff --git a/docs/api/paddle/nn/LayerDict_cn.rst b/docs/api/paddle/nn/LayerDict_cn.rst index 27700dcd833..c1e7511a4a2 100644 --- a/docs/api/paddle/nn/LayerDict_cn.rst +++ b/docs/api/paddle/nn/LayerDict_cn.rst @@ -98,7 +98,7 @@ update() **参数** - - **sublayers** (LayerDict|OrderedDict|list[(key, Layer)]) - 键值对的可迭代对象,值的类型为 `paddle.nn.Layer` 。 + - **sublayers** (LayerDict|OrderedDict|list[(key, Layer)]) - 键值对的可迭代对象,值的类型为 ``paddle.nn.Layer`` 。 **代码示例** diff --git a/docs/api/paddle/nn/MSELoss_cn.rst b/docs/api/paddle/nn/MSELoss_cn.rst index c762fe43238..21e5b527f81 100644 --- a/docs/api/paddle/nn/MSELoss_cn.rst +++ b/docs/api/paddle/nn/MSELoss_cn.rst @@ -14,12 +14,12 @@ MSELoss .. math:: Out = (input - label)^2 -当`reduction`为`'mean'`时: +当 ``reduction`` 为 ``'mean'`` 时: .. math:: Out = \operatorname{mean}((input - label)^2) -当`reduction`为`'sum'`时: +当 ``reduction`` 为 ``'sum'`` 时: .. math:: Out = \operatorname{sum}((input - label)^2) diff --git a/docs/api/paddle/nn/MaxUnPool1D_cn.rst b/docs/api/paddle/nn/MaxUnPool1D_cn.rst index 354c8be0c44..3679b702402 100644 --- a/docs/api/paddle/nn/MaxUnPool1D_cn.rst +++ b/docs/api/paddle/nn/MaxUnPool1D_cn.rst @@ -5,7 +5,7 @@ MaxUnPool1D .. py:class:: paddle.nn.MaxUnPool1D(kernel_size, stride=None, padding=0, data_format="NCL", output_size=None, name=None) -构建 `MaxUnPool1D` 类的一个可调用对象,根据输入的 input 和最大值位置计算出池化的逆结果。所有非最大值设置为零。 +构建 ``MaxUnPool1D`` 类的一个可调用对象,根据输入的 input 和最大值位置计算出池化的逆结果。所有非最大值设置为零。 输入: X 形状::math:`(N, C, L_{in})` @@ -15,7 +15,7 @@ MaxUnPool1D .. math:: L_{out} = (L_{in} - 1) \times \text{stride} - 2 \times \text{padding} + \text{kernel_size} -或由参数 `output_size` 直接指定。 +或由参数 ``output_size`` 直接指定。 diff --git a/docs/api/paddle/nn/MaxUnPool2D_cn.rst b/docs/api/paddle/nn/MaxUnPool2D_cn.rst index 25bf356fb9a..eb29bf45830 100644 --- a/docs/api/paddle/nn/MaxUnPool2D_cn.rst +++ b/docs/api/paddle/nn/MaxUnPool2D_cn.rst @@ -5,7 +5,7 @@ MaxUnPool2D .. py:class:: paddle.nn.MaxUnPool2D(kernel_size, stride=None,padding=0,data_format="NCHW",output_size=None,name=None) -构建 `MaxUnPool2D` 类的一个可调用对象,根据输入的 input 和最大值位置计算出池化的逆结果。所有非最大值设置为零。 +构建 ``MaxUnPool2D`` 类的一个可调用对象,根据输入的 input 和最大值位置计算出池化的逆结果。所有非最大值设置为零。 输入: X 形状::math:`(N, C, H_{in}, W_{in})` @@ -18,7 +18,7 @@ MaxUnPool2D .. math:: W_{out} = (W_{in} - 1) \times \text{stride[1]} - 2 \times \text{padding[1]} + \text{kernel_size[1]} -或由参数 `output_size` 直接指定 +或由参数 ``output_size`` 直接指定 diff --git a/docs/api/paddle/nn/MaxUnPool3D_cn.rst b/docs/api/paddle/nn/MaxUnPool3D_cn.rst index 97f84af0ffc..ae8768f42e5 100644 --- a/docs/api/paddle/nn/MaxUnPool3D_cn.rst +++ b/docs/api/paddle/nn/MaxUnPool3D_cn.rst @@ -5,7 +5,7 @@ MaxUnPool3D .. py:class:: paddle.nn.MaxUnPool3D(kernel_size, stride=None, padding=0, data_format="NCDHW", output_size=None, name=None) -构建 `MaxUnPool3D` 类的一个可调用对象,根据输入的 input 和最大值位置计算出池化的逆结果。所有非最大值设置为零。 +构建 ``MaxUnPool3D`` 类的一个可调用对象,根据输入的 input 和最大值位置计算出池化的逆结果。所有非最大值设置为零。 输入: X 形状::math:`(N, C, D_{in}, H_{in}, W_{in})` @@ -21,7 +21,7 @@ MaxUnPool3D .. math:: W_{out} = (W_{in} - 1) \times \text{stride[2]} - 2 \times \text{padding[2]} + \text{kernel_size[2]} -或由参数 `output_size` 直接指定。 +或由参数 ``output_size`` 直接指定。 diff --git a/docs/api/paddle/nn/ModuleDict_cn.rst b/docs/api/paddle/nn/ModuleDict_cn.rst index d3eee8eeef9..ed872cac923 100644 --- a/docs/api/paddle/nn/ModuleDict_cn.rst +++ b/docs/api/paddle/nn/ModuleDict_cn.rst @@ -100,7 +100,7 @@ update() **参数** - - **modules** (ModuleDict|OrderedDict|list[(key, Module)]) - 键值对的可迭代对象,值的类型为 `paddle.nn.Module` 。 + - **modules** (ModuleDict|OrderedDict|list[(key, Module)]) - 键值对的可迭代对象,值的类型为 ``paddle.nn.Module`` 。 **代码示例** diff --git a/docs/api/paddle/nn/MultiLabelMarginLoss_cn.rst b/docs/api/paddle/nn/MultiLabelMarginLoss_cn.rst index 88ff2039138..843b67c54db 100644 --- a/docs/api/paddle/nn/MultiLabelMarginLoss_cn.rst +++ b/docs/api/paddle/nn/MultiLabelMarginLoss_cn.rst @@ -5,7 +5,7 @@ MultiLabelMarginLoss .. py:class:: paddle.nn.MultiLabelMarginLoss(reduction='mean', name=None) -创建一个 MultiLabelMarginLoss 的可调用类。通过计算输入 `input` 和 `label` 间的多类别多分类问题的 `hinge loss (margin-based loss)` 损失。 +创建一个 MultiLabelMarginLoss 的可调用类。通过计算输入 ``input`` 和 ``label`` 间的多类别多分类问题的 ``hinge loss (margin-based loss)`` 损失。 损失函数计算每一个 mini-batch 的 loss 按照下列公式计算 diff --git a/docs/api/paddle/nn/MultiLabelSoftMarginLoss_cn.rst b/docs/api/paddle/nn/MultiLabelSoftMarginLoss_cn.rst index ae8b2c5025d..d75f830b869 100644 --- a/docs/api/paddle/nn/MultiLabelSoftMarginLoss_cn.rst +++ b/docs/api/paddle/nn/MultiLabelSoftMarginLoss_cn.rst @@ -5,7 +5,7 @@ MultiLabelSoftMarginLoss .. py:class:: paddle.nn.MultiLabelSoftMarginLoss(weight:Optional=None, reduction: str = 'mean', name:str=None) -创建一个 MultiLabelSoftMarginLoss 的可调用类,MultiLabelSoftMarginLoss 计算输入 `input` 和 `label` 间的 `margin-based loss` 损失。 +创建一个 MultiLabelSoftMarginLoss 的可调用类,MultiLabelSoftMarginLoss 计算输入 ``input`` 和 ``label`` 间的 ``margin-based loss`` 损失。 损失函数按照下列公式计算 @@ -19,7 +19,7 @@ MultiLabelSoftMarginLoss 如果添加权重则再乘以对应的权重值 -最后,会添加 `reduce` 操作到前面的输出 Out 上。当 `reduction` 为 `none` 时,直接返回最原始的 `Out` 结果。当 `reduction` 为 `mean` 时,返回输出的均值 :math:`Out = MEAN(Out)` 。当 `reduction` 为 `sum` 时,返回输出的求和 :math:`Out = SUM(Out)` 。 +最后,会添加 ``reduce`` 操作到前面的输出 Out 上。当 ``reduction`` 为 ``none`` 时,直接返回最原始的 ``Out`` 结果。当 ``reduction`` 为 ``mean`` 时,返回输出的均值 :math:`Out = MEAN(Out)` 。当 ``reduction`` 为 ``sum`` 时,返回输出的求和 :math:`Out = SUM(Out)` 。 参数 diff --git a/docs/api/paddle/nn/MultiMarginLoss_cn.rst b/docs/api/paddle/nn/MultiMarginLoss_cn.rst index 86f898ece31..aaaf253624c 100644 --- a/docs/api/paddle/nn/MultiMarginLoss_cn.rst +++ b/docs/api/paddle/nn/MultiMarginLoss_cn.rst @@ -5,7 +5,7 @@ MultiMarginLoss .. py:class:: paddle.nn.MultiMarginLoss(p: int = 1, margin: float = 1.0, weight=None, reduction: str = 'mean', name:str=None) -创建一个 MultiMarginLoss 的可调用类。通过计算输入 `input` 和 `label` 间的多分类问题的 `hinge loss (margin-based loss)` 损失。 +创建一个 MultiMarginLoss 的可调用类。通过计算输入 ``input`` 和 ``label`` 间的多分类问题的 ``hinge loss (margin-based loss)`` 损失。 损失函数如果在没有权重下计算每一个 mini-batch 的 loss 按照下列公式计算 @@ -15,7 +15,7 @@ MultiMarginLoss 其中 :math:`0 \leq j \leq \text{C}-1`, 且 :math:`j \neq label_i`, :math:`0 \leq i \leq \text{N}-1` N 为 batch 数量, C 为类别数量。 -如果含有权重 `weight` 则损失函数按以下公式计算 +如果含有权重 ``weight`` 则损失函数按以下公式计算 .. math:: \text{loss}(input_i, label_i) = \frac{\sum_{j} \max(0, weight[label_i] * (\text{margin} - input_i[label_i] + input_i[j]))^p}{\text{C}} diff --git a/docs/api/paddle/nn/Overview_cn.rst b/docs/api/paddle/nn/Overview_cn.rst index 812cb8f40e8..0a8b3ece03a 100644 --- a/docs/api/paddle/nn/Overview_cn.rst +++ b/docs/api/paddle/nn/Overview_cn.rst @@ -522,7 +522,7 @@ Embedding 相关函数 " :ref:`paddle.nn.functional.triplet_margin_loss ` ", "用于计算 TripletMarginLoss" " :ref:`paddle.nn.functional.triplet_margin_with_distance_loss ` ", "用户自定义距离函数用于计算 triplet margin loss 损失" " :ref:`paddle.nn.functional.multi_label_soft_margin_loss ` ", "用于计算多分类的 hinge loss 损失函数" - " :ref:`paddle.nn.functional.hinge_embedding_loss ` ", "计算输入 input 和标签 label(包含 1 和 -1) 间的 `hinge embedding loss` 损失" + " :ref:`paddle.nn.functional.hinge_embedding_loss ` ", "计算输入 input 和标签 label(包含 1 和 -1) 间的 ``hinge embedding loss`` 损失" " :ref:`paddle.nn.functional.rnnt_loss ` ", "计算 RNNT loss,也可以叫做 softmax with RNNT" " :ref:`paddle.nn.functional.multi_margin_loss ` ", "用于计算 multi margin loss 损失函数" " :ref:`paddle.nn.functional.multi_label_margin_loss ` ", "用于计算 multi label margin loss 损失函数" diff --git a/docs/api/paddle/nn/TripletMarginLoss_cn.rst b/docs/api/paddle/nn/TripletMarginLoss_cn.rst index 3aeb2b37efe..f2df41e93dd 100644 --- a/docs/api/paddle/nn/TripletMarginLoss_cn.rst +++ b/docs/api/paddle/nn/TripletMarginLoss_cn.rst @@ -5,7 +5,7 @@ TripletMarginLoss .. py:class:: paddle.nn.TripletMarginLoss(margin: float = 1.0, p: float = 2., epsilon: float = 1e-6, swap: bool = False,reduction: str = 'mean', name:str=None) -创建一个 TripletMarginLoss 的可调用类。通过计算输入 `input` 和 `positive` 和 `negative` 间的 `triplet margin loss` 损失,测量样本之间,即 `input` 与 `positive examples` 和 `negative examples` 的相对相似性。 +创建一个 TripletMarginLoss 的可调用类。通过计算输入 ``input`` 和 ``positive`` 和 ``negative`` 间的 ``triplet margin loss`` 损失,测量样本之间,即 ``input`` 与 ``positive examples`` 和 ``negative examples`` 的相对相似性。 损失函数按照下列公式计算 diff --git a/docs/api/paddle/nn/TripletMarginWithDistanceLoss_cn.rst b/docs/api/paddle/nn/TripletMarginWithDistanceLoss_cn.rst index a079c3c98d6..59d19efda0f 100644 --- a/docs/api/paddle/nn/TripletMarginWithDistanceLoss_cn.rst +++ b/docs/api/paddle/nn/TripletMarginWithDistanceLoss_cn.rst @@ -5,7 +5,7 @@ TripletMarginWithDistanceLoss .. py:class:: paddle.nn.TripletMarginWithDistanceLoss(distance_function=None, margin: float = 1.0, swap: bool = False, reduction: str = 'mean', name:str=None) -创建一个 TripletMarginWithDistanceLoss 的可调用类,通过计算输入 `input` 和 `positive` 和 `negative` 间的 `triplet margin loss` 损失,测量样本之间,即 `input` 与 `positive examples` 和 `negative examples` 的相对相似性。 +创建一个 TripletMarginWithDistanceLoss 的可调用类,通过计算输入 ``input`` 和 ``positive`` 和 ``negative`` 间的 ``triplet margin loss`` 损失,测量样本之间,即 ``input`` 与 ``positive examples`` 和 ``negative examples`` 的相对相似性。 损失函数按照下列公式计算 diff --git a/docs/api/paddle/nn/Unfold_cn.rst b/docs/api/paddle/nn/Unfold_cn.rst index 7f1afed0957..be6bd483847 100644 --- a/docs/api/paddle/nn/Unfold_cn.rst +++ b/docs/api/paddle/nn/Unfold_cn.rst @@ -11,7 +11,7 @@ Unfold 实现的功能与卷积中用到的 im2col 函数一样,通常也被称作为 im2col 过程。对于每一个卷积核覆盖下的区域,元素会被重新排成一列。当卷积核在整个图片上滑动时,将会形成一系列的列向量。对于每一个输入形状为[N, C, H, W]的 ``x``,都将会按照下面公式计算出一个形状为[N, Cout, Lout]的输出。 .. note:: - 对应的 `functional 方法` 请参考::ref:`cn_api_paddle_nn_functional_unfold`。 + 对应的 ``functional 方法`` 请参考::ref:`cn_api_paddle_nn_functional_unfold`。 **样例**: diff --git a/docs/api/paddle/nn/functional/adaptive_avg_pool1d_cn.rst b/docs/api/paddle/nn/functional/adaptive_avg_pool1d_cn.rst index 7ba737d9e2c..4c0b41a71b9 100755 --- a/docs/api/paddle/nn/functional/adaptive_avg_pool1d_cn.rst +++ b/docs/api/paddle/nn/functional/adaptive_avg_pool1d_cn.rst @@ -8,7 +8,7 @@ adaptive_avg_pool1d 根据 ``output_size`` 对 Tensor ``x`` 计算 1D 自适应平均池化。 .. note:: - 详细请参考对应的 `Class` 请参考::ref:`cn_api_paddle_nn_AdaptiveAvgPool1D`。 + 详细请参考对应的 ``Class`` 请参考::ref:`cn_api_paddle_nn_AdaptiveAvgPool1D`。 参数 diff --git a/docs/api/paddle/nn/functional/adaptive_max_pool1d_cn.rst b/docs/api/paddle/nn/functional/adaptive_max_pool1d_cn.rst index 26a38bed7bf..98b99a6d350 100755 --- a/docs/api/paddle/nn/functional/adaptive_max_pool1d_cn.rst +++ b/docs/api/paddle/nn/functional/adaptive_max_pool1d_cn.rst @@ -10,7 +10,7 @@ adaptive_max_pool1d .. note:: - 详细请参考对应的 `Class` 请参考::ref:`cn_api_paddle_nn_AdaptiveMaxPool1D` 。 + 详细请参考对应的 ``Class`` 请参考::ref:`cn_api_paddle_nn_AdaptiveMaxPool1D` 。 参数 diff --git a/docs/api/paddle/nn/functional/avg_pool1d_cn.rst b/docs/api/paddle/nn/functional/avg_pool1d_cn.rst index ab61f7351ca..a2934233b7b 100755 --- a/docs/api/paddle/nn/functional/avg_pool1d_cn.rst +++ b/docs/api/paddle/nn/functional/avg_pool1d_cn.rst @@ -9,7 +9,7 @@ avg_pool1d 默认是以 ``NCL`` 格式表示的,其中 ``N`` 是 batch size, ``C`` 是通道数,``L`` 是输入特征的长度。 .. note:: - 详细请参考对应的 `Class` 请参考::ref:`cn_api_paddle_nn_AvgPool1D` 。 + 详细请参考对应的 ``Class`` 请参考::ref:`cn_api_paddle_nn_AvgPool1D` 。 参数 diff --git a/docs/api/paddle/nn/functional/avg_pool2d_cn.rst b/docs/api/paddle/nn/functional/avg_pool2d_cn.rst index 8c565b2d5f2..4dd9cf21237 100644 --- a/docs/api/paddle/nn/functional/avg_pool2d_cn.rst +++ b/docs/api/paddle/nn/functional/avg_pool2d_cn.rst @@ -4,8 +4,8 @@ avg_pool2d ------------------------------- .. py:function:: paddle.nn.functional.avg_pool2d(x, kernel_size, stride=None, padding=0, ceil_mode=False, exclusive=True, divisor_override=None, data_format="NCHW", name=None) -该函数是一个二维平均池化函数,其将构建一个二维平均池化层,根据输入参数 `kernel_size`, `stride`, -`padding` 等参数对输入做平均池化操作。 +该函数是一个二维平均池化函数,其将构建一个二维平均池化层,根据输入参数 ``kernel_size``, ``stride``, +``padding`` 等参数对输入做平均池化操作。 例如: diff --git a/docs/api/paddle/nn/functional/avg_pool3d_cn.rst b/docs/api/paddle/nn/functional/avg_pool3d_cn.rst index 80df259eb76..1e8d3d6f35f 100644 --- a/docs/api/paddle/nn/functional/avg_pool3d_cn.rst +++ b/docs/api/paddle/nn/functional/avg_pool3d_cn.rst @@ -4,8 +4,8 @@ avg_pool3d ------------------------------- .. py:function:: paddle.nn.functional.avg_pool3d(x, kernel_size, stride=None, padding=0, ceil_mode=False, exclusive=True, divisor_override=None, data_format="NCDHW", name=None) -该函数是一个三维平均池化函数,根据输入参数 `kernel_size`, `stride`, -`padding` 等参数对输入做平均池化操作。 +该函数是一个三维平均池化函数,根据输入参数 ``kernel_size``, ``stride``, +``padding`` 等参数对输入做平均池化操作。 例如: diff --git a/docs/api/paddle/nn/functional/channel_shuffle_cn.rst b/docs/api/paddle/nn/functional/channel_shuffle_cn.rst index e7fce5bffc4..a70b314dbe5 100644 --- a/docs/api/paddle/nn/functional/channel_shuffle_cn.rst +++ b/docs/api/paddle/nn/functional/channel_shuffle_cn.rst @@ -7,7 +7,7 @@ channel_shuffle 将一个形为 [N, C, H, W] 或是 [N, H, W, C] 的 Tensor 按通道分成 g 组,得到形为 [N, g, C/g, H, W] 或 [N, H, W, g, C/g] 的 Tensor,然后转置为 [N, C/g, g, H, W] 或 [N, H, W, C/g, g] 的形状,最后重塑为原来的形状。这样做可以增加通道间的信息流动,提高特征的重用率。详见张祥雨等人在 2017 年发表的论文 `ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices `_ 。 .. note:: - 详细请参考对应的 `Class` 请参考::ref:`cn_api_paddle_nn_ChannelShuffle`。 + 详细请参考对应的 ``Class`` 请参考::ref:`cn_api_paddle_nn_ChannelShuffle`。 参数 ::::::::: diff --git a/docs/api/paddle/nn/functional/ctc_loss_cn.rst b/docs/api/paddle/nn/functional/ctc_loss_cn.rst index 44d47054561..6b866e84328 100644 --- a/docs/api/paddle/nn/functional/ctc_loss_cn.rst +++ b/docs/api/paddle/nn/functional/ctc_loss_cn.rst @@ -21,7 +21,7 @@ ctc_loss 返回 ::::::::: -``Tensor``,输入 ``log_probs`` 和标签 ``labels`` 间的 `ctc loss`。如果 :attr:`reduction` 是 ``'none'``,则输出 loss 的维度为 [batch_size]。如果 :attr:`reduction` 是 ``'mean'`` 或 ``'sum'``,则输出 Loss 的维度为 []。数据类型与输入的 ``log_probs`` 一致。 +``Tensor``,输入 ``log_probs`` 和标签 ``labels`` 间的 ``ctc loss``。如果 :attr:`reduction` 是 ``'none'``,则输出 loss 的维度为 [batch_size]。如果 :attr:`reduction` 是 ``'mean'`` 或 ``'sum'``,则输出 Loss 的维度为 []。数据类型与输入的 ``log_probs`` 一致。 代码示例 diff --git a/docs/api/paddle/nn/functional/elu__cn.rst b/docs/api/paddle/nn/functional/elu__cn.rst index f7fbce8eb32..109e994fe05 100644 --- a/docs/api/paddle/nn/functional/elu__cn.rst +++ b/docs/api/paddle/nn/functional/elu__cn.rst @@ -5,7 +5,7 @@ elu\_ .. py:function:: paddle.nn.functional.elu_(x, alpha=1.0, name=None) -Inplace 版本的 :ref:`cn_api_paddle_nn_functional_elu` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_nn_functional_elu` API,对输入 ``x`` 采用 Inplace 策略。 更多关于 inplace 操作的介绍请参考 `3.1.3 原位(Inplace)操作和非原位操作的区别`_ 了解详情。 diff --git a/docs/api/paddle/nn/functional/fractional_max_pool2d_cn.rst b/docs/api/paddle/nn/functional/fractional_max_pool2d_cn.rst index 8bcd333ddab..7a1b95c09a9 100644 --- a/docs/api/paddle/nn/functional/fractional_max_pool2d_cn.rst +++ b/docs/api/paddle/nn/functional/fractional_max_pool2d_cn.rst @@ -5,11 +5,11 @@ fractional_max_pool2d .. py:function:: paddle.nn.functional.fractional_max_pool2d(x, output_size, kernel_size=None, random_u=None, return_mask=False, name=None) -对输入的 Tensor `x` 采取 `2` 维分数阶最大值池化操作,具体可以参考论文: +对输入的 Tensor ``x`` 采取 ``2`` 维分数阶最大值池化操作,具体可以参考论文: [1] Ben Graham, Fractional Max-Pooling. 2015. http://arxiv.org/abs/1412.6071 -其中输出的 `H` 和 `W` 由参数 `output_size` 决定。 +其中输出的 ``H`` 和 ``W`` 由参数 ``output_size`` 决定。 对于各个输出维度,分数阶最大值池化的计算公式为: @@ -25,12 +25,12 @@ fractional_max_pool2d where, u \in (0, 1), i = 0,1,2...size_{output} -公式中的 `u` 即为函数中的参数 `random_u`。另外,由于 `ceil` 对于正小数的操作最小值为 `1` ,因此这里需要再减去 `1` 使索引可以从 `0` 开始计数。 +公式中的 ``u`` 即为函数中的参数 ``random_u``。另外,由于 ``ceil`` 对于正小数的操作最小值为 ``1`` ,因此这里需要再减去 ``1`` 使索引可以从 ``0`` 开始计数。 -例如,有一个长度为 `7` 的序列 `[2, 4, 3, 1, 5, 2, 3]` , `output_size` 为 `5` , `random_u` 为 `0.3`。 -则由上述公式可得 `alpha = 7/5 = 1.4` , 索引的起始序列为 `[0, 1, 3, 4, 6]` ,索引的截止序列为 `[1, 3, 4, 6, 7]` 。 -进而得到论文中的随机序列为 `index_end - index_start = [1, 2, 1, 2, 1]` 。 -由于池化操作的步长与核尺寸相同,同为此随机序列,最终得到池化输出为 `[2, 4, 1, 5, 3]` 。 +例如,有一个长度为 ``7`` 的序列 ``[2, 4, 3, 1, 5, 2, 3]`` , ``output_size`` 为 ``5`` , ``random_u`` 为 ``0.3``。 +则由上述公式可得 ``alpha = 7/5 = 1.4`` , 索引的起始序列为 ``[0, 1, 3, 4, 6]`` ,索引的截止序列为 ``[1, 3, 4, 6, 7]`` 。 +进而得到论文中的随机序列为 ``index_end - index_start = [1, 2, 1, 2, 1]`` 。 +由于池化操作的步长与核尺寸相同,同为此随机序列,最终得到池化输出为 ``[2, 4, 1, 5, 3]`` 。 参数 ::::::::: @@ -43,7 +43,7 @@ fractional_max_pool2d 返回 ::::::::: -`Tensor`,输入 `x` 经过分数阶最大值池化计算得到的目标 4-D Tensor,其数据类型与输入相同。 +``Tensor``,输入 ``x`` 经过分数阶最大值池化计算得到的目标 4-D Tensor,其数据类型与输入相同。 代码示例 ::::::::: diff --git a/docs/api/paddle/nn/functional/fractional_max_pool3d_cn.rst b/docs/api/paddle/nn/functional/fractional_max_pool3d_cn.rst index 828762b4db0..31aaf6d0e98 100644 --- a/docs/api/paddle/nn/functional/fractional_max_pool3d_cn.rst +++ b/docs/api/paddle/nn/functional/fractional_max_pool3d_cn.rst @@ -5,11 +5,11 @@ fractional_max_pool3d .. py:function:: paddle.nn.functional.fractional_max_pool3d(x, output_size, kernel_size=None, random_u=None, return_mask=False, name=None) -对输入的 Tensor `x` 采取 `3` 维分数阶最大值池化操作,具体可以参考论文: +对输入的 Tensor ``x`` 采取 ``3`` 维分数阶最大值池化操作,具体可以参考论文: [1] Ben Graham, Fractional Max-Pooling. 2015. http://arxiv.org/abs/1412.6071 -其中输出的 `D`, `H` 和 `W` 由参数 `output_size` 决定。 +其中输出的 ``D``, ``H`` 和 ``W`` 由参数 ``output_size`` 决定。 对于各个输出维度,分数阶最大值池化的计算公式为: @@ -25,12 +25,12 @@ fractional_max_pool3d where, u \in (0, 1), i = 0,1,2...size_{output} -公式中的 `u` 即为函数中的参数 `random_u`。另外,由于 `ceil` 对于正小数的操作最小值为 `1` ,因此这里需要再减去 `1` 使索引可以从 `0` 开始计数。 +公式中的 ``u`` 即为函数中的参数 ``random_u``。另外,由于 ``ceil`` 对于正小数的操作最小值为 ``1`` ,因此这里需要再减去 ``1`` 使索引可以从 ``0`` 开始计数。 -例如,有一个长度为 `7` 的序列 `[2, 4, 3, 1, 5, 2, 3]` , `output_size` 为 `5` , `random_u` 为 `0.3`。 -则由上述公式可得 `alpha = 7/5 = 1.4` , 索引的起始序列为 `[0, 1, 3, 4, 6]` ,索引的截止序列为 `[1, 3, 4, 6, 7]` 。 -进而得到论文中的随机序列为 `index_end - index_start = [1, 2, 1, 2, 1]` 。 -由于池化操作的步长与核尺寸相同,同为此随机序列,最终得到池化输出为 `[2, 4, 1, 5, 3]` 。 +例如,有一个长度为 ``7`` 的序列 ``[2, 4, 3, 1, 5, 2, 3]`` , ``output_size`` 为 ``5`` , ``random_u`` 为 ``0.3``。 +则由上述公式可得 ``alpha = 7/5 = 1.4`` , 索引的起始序列为 ``[0, 1, 3, 4, 6]`` ,索引的截止序列为 ``[1, 3, 4, 6, 7]`` 。 +进而得到论文中的随机序列为 ``index_end - index_start = [1, 2, 1, 2, 1]`` 。 +由于池化操作的步长与核尺寸相同,同为此随机序列,最终得到池化输出为 ``[2, 4, 1, 5, 3]`` 。 参数 ::::::::: @@ -43,7 +43,7 @@ fractional_max_pool3d 返回 ::::::::: -`Tensor`,输入 `x` 经过分数阶最大值池化计算得到的目标 5-D Tensor,其数据类型与输入相同。 +``Tensor``,输入 ``x`` 经过分数阶最大值池化计算得到的目标 5-D Tensor,其数据类型与输入相同。 代码示例 ::::::::: diff --git a/docs/api/paddle/nn/functional/hardtanh_cn.rst b/docs/api/paddle/nn/functional/hardtanh_cn.rst index 8188ff34e4e..5606fe7e903 100644 --- a/docs/api/paddle/nn/functional/hardtanh_cn.rst +++ b/docs/api/paddle/nn/functional/hardtanh_cn.rst @@ -4,7 +4,7 @@ hardtanh ------------------------------- .. py:function:: paddle.nn.functional.hardtanh(x, min=-1.0, max=1.0, name=None) -hardtanh 激活层(Hardtanh Activation Operator)。计算输入 `x` 的 `hardtanh` 值。计算公式如下: +hardtanh 激活层(Hardtanh Activation Operator)。计算输入 ``x`` 的 ``hardtanh`` 值。计算公式如下: .. math:: diff --git a/docs/api/paddle/nn/functional/lp_pool1d_cn.rst b/docs/api/paddle/nn/functional/lp_pool1d_cn.rst index ea83afec2be..d70ab576a07 100644 --- a/docs/api/paddle/nn/functional/lp_pool1d_cn.rst +++ b/docs/api/paddle/nn/functional/lp_pool1d_cn.rst @@ -9,7 +9,7 @@ lp_pool1d 默认是以 ``NCL`` 格式表示的,其中 ``N`` 是 batch size, ``C`` 是通道数,``L`` 是输入特征的长度。 .. note:: - 详细请参考对应的 `Class` 请参考::ref:`cn_api_paddle_nn_LPPool1D` 。 + 详细请参考对应的 ``Class`` 请参考::ref:`cn_api_paddle_nn_LPPool1D` 。 参数 diff --git a/docs/api/paddle/nn/functional/lp_pool2d_cn.rst b/docs/api/paddle/nn/functional/lp_pool2d_cn.rst index 97a53cad8d6..fc17ebfd98b 100644 --- a/docs/api/paddle/nn/functional/lp_pool2d_cn.rst +++ b/docs/api/paddle/nn/functional/lp_pool2d_cn.rst @@ -4,8 +4,8 @@ lp_pool2d ------------------------------- .. py:function:: paddle.nn.functional.lp_pool2d(x, norm_type, kernel_size, stride=None, padding=0, ceil_mode=False, data_format="NCHW", name=None) -该函数是一个二维幂平均池化函数,其将构建一个二维幂平均池化层,根据输入参数 `kernel_size`, `stride`, -`padding` 等参数对输入做平均池化操作。 +该函数是一个二维幂平均池化函数,其将构建一个二维幂平均池化层,根据输入参数 ``kernel_size``, ``stride``, +``padding`` 等参数对输入做平均池化操作。 例如: diff --git a/docs/api/paddle/nn/functional/max_pool1d_cn.rst b/docs/api/paddle/nn/functional/max_pool1d_cn.rst index 1320ebffc59..dc1a409b652 100755 --- a/docs/api/paddle/nn/functional/max_pool1d_cn.rst +++ b/docs/api/paddle/nn/functional/max_pool1d_cn.rst @@ -9,7 +9,7 @@ max_pool1d 默认是以 ``NCL`` 格式表示的,其中 ``N`` 是 batch size, ``C`` 是通道数,``L`` 是输入特征的长度。 .. note:: - 详细请参考对应的 `Class` 请参考::ref:`cn_api_paddle_nn_MaxPool1D` 。 + 详细请参考对应的 ``Class`` 请参考::ref:`cn_api_paddle_nn_MaxPool1D` 。 参数 ::::::::: diff --git a/docs/api/paddle/nn/functional/max_pool2d_cn.rst b/docs/api/paddle/nn/functional/max_pool2d_cn.rst index fd9af4721f6..253d4dce40b 100644 --- a/docs/api/paddle/nn/functional/max_pool2d_cn.rst +++ b/docs/api/paddle/nn/functional/max_pool2d_cn.rst @@ -4,8 +4,8 @@ max_pool2d ------------------------------- .. py:function:: paddle.nn.functional.max_pool2d(x, kernel_size, stride=None, padding=0, return_mask=False, ceil_mode=False, dilation=1, data_format="NCHW", name=None) -构建 `max_pool2d` 类的一个可调用对象,其将构建一个二维最大池化层,根据输入参数 `kernel_size`, `stride`, -`padding` 等参数对输入做最大池化操作。 +构建 ``max_pool2d`` 类的一个可调用对象,其将构建一个二维最大池化层,根据输入参数 ``kernel_size``, ``stride``, +``padding`` 等参数对输入做最大池化操作。 例如: diff --git a/docs/api/paddle/nn/functional/max_pool3d_cn.rst b/docs/api/paddle/nn/functional/max_pool3d_cn.rst index 1e82d14d3c8..a3d57d9c580 100644 --- a/docs/api/paddle/nn/functional/max_pool3d_cn.rst +++ b/docs/api/paddle/nn/functional/max_pool3d_cn.rst @@ -4,8 +4,8 @@ max_pool3d ------------------------------- .. py:function:: paddle.nn.functional.max_pool3d(x, kernel_size, stride=None, padding=0, return_mask=False, ceil_mode=False, dilation=1, data_format="NCDHW", name=None) -该函数是一个三维最大池化函数,根据输入参数 `kernel_size`, `stride`, -`padding` 等参数对输入 `x` 做最大池化操作。 +该函数是一个三维最大池化函数,根据输入参数 ``kernel_size``, ``stride``, +``padding`` 等参数对输入 ``x`` 做最大池化操作。 例如: diff --git a/docs/api/paddle/nn/functional/max_unpool1d_cn.rst b/docs/api/paddle/nn/functional/max_unpool1d_cn.rst index b74e8b8b597..d2e4f8aa2f1 100644 --- a/docs/api/paddle/nn/functional/max_unpool1d_cn.rst +++ b/docs/api/paddle/nn/functional/max_unpool1d_cn.rst @@ -5,10 +5,10 @@ max_unpool1d .. py:function:: paddle.nn.functional.max_unpool1d(x, indices, kernel_size, stride=None, padding=0, data_format="NCL", output_size=None, name=None) -这个 API 实现了 `1D 最大反池化` 操作 +这个 API 实现了 ``1D 最大反池化`` 操作 .. note:: - 更多细节请参考对应的 `Class` 请参考 :ref:`cn_api_paddle_nn_MaxUnPool1D` 。 + 更多细节请参考对应的 ``Class`` 请参考 :ref:`cn_api_paddle_nn_MaxUnPool1D` 。 输入: @@ -19,7 +19,7 @@ max_unpool1d .. math:: L_{out} = (L_{in} - 1) \times \text{stride} - 2 \times \text{padding} + \text{kernel_size} -或由参数 `output_size` 直接指定 +或由参数 ``output_size`` 直接指定 参数 diff --git a/docs/api/paddle/nn/functional/max_unpool2d_cn.rst b/docs/api/paddle/nn/functional/max_unpool2d_cn.rst index 3ea2f558e32..9ac94cac724 100644 --- a/docs/api/paddle/nn/functional/max_unpool2d_cn.rst +++ b/docs/api/paddle/nn/functional/max_unpool2d_cn.rst @@ -5,10 +5,10 @@ max_unpool2d .. py:function:: paddle.nn.functional.max_unpool2d(x, indices, kernel_size, stride=None,padding=0,data_format="NCHW",output_size=None,name=None) -这个 API 实现了 `2D 最大反池化` 操作 +这个 API 实现了 ``2D 最大反池化`` 操作 .. note:: - 更多细节请参考对应的 `Class` 请参考 :ref:`cn_api_paddle_nn_MaxUnPool2D` 。 + 更多细节请参考对应的 ``Class`` 请参考 :ref:`cn_api_paddle_nn_MaxUnPool2D` 。 输入: @@ -22,7 +22,7 @@ max_unpool2d .. math:: W_{out} = (W_{in} - 1) \times \text{stride[1]} - 2 \times \text{padding[1]} + \text{kernel_size[1]} -或由参数 `output_size` 直接指定 +或由参数 ``output_size`` 直接指定 参数 diff --git a/docs/api/paddle/nn/functional/max_unpool3d_cn.rst b/docs/api/paddle/nn/functional/max_unpool3d_cn.rst index 41e44338aff..e9f7effbd55 100644 --- a/docs/api/paddle/nn/functional/max_unpool3d_cn.rst +++ b/docs/api/paddle/nn/functional/max_unpool3d_cn.rst @@ -5,10 +5,10 @@ max_unpool3d .. py:function:: paddle.nn.functional.max_unpool3d(x, indices, kernel_size, stride=None, padding=0, data_format="NCDHW", output_size=None, name=None) -这个 API 实现了 `3D 最大反池化` 操作 +这个 API 实现了 ``3D 最大反池化`` 操作 .. note:: - 更多细节请参考对应的 `Class` 请参考 :ref:`cn_api_paddle_nn_MaxUnPool3D` 。 + 更多细节请参考对应的 ``Class`` 请参考 :ref:`cn_api_paddle_nn_MaxUnPool3D` 。 输入: @@ -25,7 +25,7 @@ max_unpool3d .. math:: W_{out} = (W_{in} - 1) \times \text{stride[2]} - 2 \times \text{padding[2]} + \text{kernel_size[2]} -或由参数 `output_size` 直接指定 +或由参数 ``output_size`` 直接指定 参数 diff --git a/docs/api/paddle/nn/functional/pixel_unshuffle_cn.rst b/docs/api/paddle/nn/functional/pixel_unshuffle_cn.rst index 6369d4c1d5c..5ebf43558df 100644 --- a/docs/api/paddle/nn/functional/pixel_unshuffle_cn.rst +++ b/docs/api/paddle/nn/functional/pixel_unshuffle_cn.rst @@ -7,7 +7,7 @@ pixel_unshuffle 将一个形为 :math:`[N, C, H, W]` 或 :math:`[N, H, W, C]` 的 Tensor 重新排列成形为 :math:`[N, r^2C, H/r, W/r]` 或 :math:`[N, H/r, W/r, r^2C]` 的 Tensor,这里 :math:`r` 是减小空间分辨率的减小因子。这个算子是 pixel_shuffle 算子(请参考::ref:`cn_api_paddle_nn_functional_pixel_shuffle`)的逆算子。详见施闻哲等人在 2016 年发表的论文 `Real Time Single Image and Video Super Resolution Using an Efficient Sub Pixel Convolutional Neural Network `_ 。 .. note:: - 详细请参考对应的 `Class` 请参考::ref:`cn_api_paddle_nn_PixelUnshuffle` 。 + 详细请参考对应的 ``Class`` 请参考::ref:`cn_api_paddle_nn_PixelUnshuffle` 。 参数 ::::::::: diff --git a/docs/api/paddle/nn/functional/prelu_cn.rst b/docs/api/paddle/nn/functional/prelu_cn.rst index b29acc7b4d5..e0127c33321 100644 --- a/docs/api/paddle/nn/functional/prelu_cn.rst +++ b/docs/api/paddle/nn/functional/prelu_cn.rst @@ -11,7 +11,7 @@ prelu 激活层(PRelu Activation Operator)。计算公式如下: prelu(x) = max(0, x) + weight * min(0, x) -其中,:math:`x` 和 `weight` 为输入的 Tensor +其中,:math:`x` 和 ``weight`` 为输入的 Tensor 参数 :::::::::: diff --git a/docs/api/paddle/nn/functional/relu__cn.rst b/docs/api/paddle/nn/functional/relu__cn.rst index 32f09e5e823..419f257a1b3 100644 --- a/docs/api/paddle/nn/functional/relu__cn.rst +++ b/docs/api/paddle/nn/functional/relu__cn.rst @@ -5,7 +5,7 @@ relu\_ .. py:function:: paddle.nn.functional.relu_(x, name=None) -Inplace 版本的 :ref:`cn_api_paddle_nn_functional_relu` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_nn_functional_relu` API,对输入 ``x`` 采用 Inplace 策略。 更多关于 inplace 操作的介绍请参考 `3.1.3 原位(Inplace)操作和非原位操作的区别`_ 了解详情。 diff --git a/docs/api/paddle/nn/functional/rnnt_loss_cn.rst b/docs/api/paddle/nn/functional/rnnt_loss_cn.rst index b11e43361bb..5721791e953 100644 --- a/docs/api/paddle/nn/functional/rnnt_loss_cn.rst +++ b/docs/api/paddle/nn/functional/rnnt_loss_cn.rst @@ -21,7 +21,7 @@ rnnt_loss 返回 ::::::::: -``Tensor``,输入 ``input`` 和标签 ``labels`` 间的 `rnnt loss`。如果 :attr:`reduction` 是 ``'none'``,则输出 loss 的维度为 [batch_size]。如果 :attr:`reduction` 是 ``'mean'`` 或 ``'sum'``,则输出 Loss 的维度为 []。数据类型与输入的 ``input`` 一致。 +``Tensor``,输入 ``input`` 和标签 ``labels`` 间的 ``rnnt loss``。如果 :attr:`reduction` 是 ``'none'``,则输出 loss 的维度为 [batch_size]。如果 :attr:`reduction` 是 ``'mean'`` 或 ``'sum'``,则输出 Loss 的维度为 []。数据类型与输入的 ``input`` 一致。 代码示例 diff --git a/docs/api/paddle/nn/functional/softmax__cn.rst b/docs/api/paddle/nn/functional/softmax__cn.rst index 185942c6cc3..21d6b03ec27 100644 --- a/docs/api/paddle/nn/functional/softmax__cn.rst +++ b/docs/api/paddle/nn/functional/softmax__cn.rst @@ -4,7 +4,7 @@ softmax\_ ------------------------------- .. py:function:: paddle.nn.functional.softmax_(x, axis=-1, dtype=None, name=None) -Inplace 版本的 :ref:`cn_api_paddle_nn_functional_softmax` API,对输入 `x` 采用 Inplace 策略。 +Inplace 版本的 :ref:`cn_api_paddle_nn_functional_softmax` API,对输入 ``x`` 采用 Inplace 策略。 更多关于 inplace 操作的介绍请参考 `3.1.3 原位(Inplace)操作和非原位操作的区别`_ 了解详情。 diff --git a/docs/api/paddle/nn/initializer/Dirac_cn.rst b/docs/api/paddle/nn/initializer/Dirac_cn.rst index 5ef281db148..20c0d308638 100644 --- a/docs/api/paddle/nn/initializer/Dirac_cn.rst +++ b/docs/api/paddle/nn/initializer/Dirac_cn.rst @@ -8,7 +8,7 @@ Dirac 通过 ``狄拉克 delta 函数`` 来初始化 3D/4D/5D Tensor。 -该初始化方式一般用于 Conv1D/Conv2D/Conv3D 卷积层,能尽可能多的保留卷积层输入的特性。(如果 `out_channels` > `in_channels`,则可保留全部的输入 `channel` 特性) +该初始化方式一般用于 Conv1D/Conv2D/Conv3D 卷积层,能尽可能多的保留卷积层输入的特性。(如果 ``out_channels`` > ``in_channels``,则可保留全部的输入 ``channel`` 特性) 被初始化的参数,每个卷积核中间的元素会被置为 1,其余元素为 0。公式可以描述为: @@ -16,7 +16,7 @@ Dirac X[d, d, shape[2]//2, shape[3]//2, ...]=1 ; d=0,1...N -其中 N 为 `out_channels` 和 `in_channels` 中的较小值。 +其中 N 为 ``out_channels`` 和 ``in_channels`` 中的较小值。 参数 diff --git a/docs/api/paddle/nn/initializer/TruncatedNormal_cn.rst b/docs/api/paddle/nn/initializer/TruncatedNormal_cn.rst index 824428f4c7e..ec4dbb45ec1 100644 --- a/docs/api/paddle/nn/initializer/TruncatedNormal_cn.rst +++ b/docs/api/paddle/nn/initializer/TruncatedNormal_cn.rst @@ -8,7 +8,7 @@ TruncatedNormal 截断正态分布(高斯分布)初始化方法。 .. note:: - 在参数设置时建议将 `mean` 设为 :math:`a \le mean \le b`。 + 在参数设置时建议将 ``mean`` 设为 :math:`a \le mean \le b`。 若 :math:`mean < a - 2 \cdot std` 或 :math:`mean > b + 2 \cdot std`,采样值的分布可能是有误的。 参数 diff --git a/docs/api/paddle/nn/utils/weight_norm_cn.rst b/docs/api/paddle/nn/utils/weight_norm_cn.rst index fdd9856a16b..4c75e2abbd2 100644 --- a/docs/api/paddle/nn/utils/weight_norm_cn.rst +++ b/docs/api/paddle/nn/utils/weight_norm_cn.rst @@ -10,7 +10,7 @@ weight_norm .. math:: \mathbf{w} = g \dfrac{v}{\|v\|} -权重归一化可以将神经网络中权重向量的长度与其方向解耦,权重归一化可以用两个变量(例如:代表长度的变量 `weight_g` 和代表方向的变量 `weight_v`)来代替由名字(例如:`weight`)指定的变量。详细可以参考论文:`A Simple Reparameterization to Accelerate Training of Deep Neural Networks `_ +权重归一化可以将神经网络中权重向量的长度与其方向解耦,权重归一化可以用两个变量(例如:代表长度的变量 ``weight_g`` 和代表方向的变量 ``weight_v``)来代替由名字(例如:``weight``)指定的变量。详细可以参考论文:`A Simple Reparameterization to Accelerate Training of Deep Neural Networks `_ 参数 :::::::::::: diff --git a/docs/api/paddle/shard_index_cn.rst b/docs/api/paddle/shard_index_cn.rst index a25d92f90e7..55a7f109fcb 100644 --- a/docs/api/paddle/shard_index_cn.rst +++ b/docs/api/paddle/shard_index_cn.rst @@ -5,13 +5,13 @@ shard_index .. py:function:: paddle.shard_index(input, index_num, nshards, shard_id, ignore_value=-1) -根据当前 shard 重新设置输入参数\ `input`\ 的值。输入\ `input`\ 中的值需要为非负整型;参数\ `index_num`\ 为用户设置的大于\ `input`\ 最大值的整型值。因此,\ `input`\ 中的值属于区间[0, index_num),且每个值可以被看作到区间起始的偏移量。区间可以被进一步划分为多个切片。具体地讲,我们首先根据下面的公式计算每个切片的大小:\ `shard_size`\,表示每个切片可以表示的整数的数量。因此,对于第\ `i`\ 个切片,其表示的区间为[i*shard_size, (i+1)*shard_size)。 +根据当前 shard 重新设置输入参数\ ``input``\ 的值。输入\ ``input``\ 中的值需要为非负整型;参数\ ``index_num``\ 为用户设置的大于\ ``input``\ 最大值的整型值。因此,\ ``input``\ 中的值属于区间[0, index_num),且每个值可以被看作到区间起始的偏移量。区间可以被进一步划分为多个切片。具体地讲,我们首先根据下面的公式计算每个切片的大小:\ ``shard_size``\,表示每个切片可以表示的整数的数量。因此,对于第\ ``i``\ 个切片,其表示的区间为[i*shard_size, (i+1)*shard_size)。 :: shard_size = (index_num + nshards - 1) // nshards -对于输入\ `input`\ 中的每个值\ `v`\,我们根据下面的公式设置它新的值: +对于输入\ ``input``\ 中的每个值\ ``v``\,我们根据下面的公式设置它新的值: :: diff --git a/docs/api/paddle/slice_scatter_cn.rst b/docs/api/paddle/slice_scatter_cn.rst index 9e3857b4c2b..36ca6bb1704 100644 --- a/docs/api/paddle/slice_scatter_cn.rst +++ b/docs/api/paddle/slice_scatter_cn.rst @@ -5,7 +5,7 @@ slice_scatter .. py:function:: paddle.slice_scatter(x, value, axes, starts, ends, strides, name=None) -沿着 `axes` 将 `value` 矩阵的值嵌入到 `x` 矩阵。返回一个新的 Tensor 而不是视图。 `axes` 需要与 `starts`, `ends` 和 `strides` 尺寸一致。 +沿着 ``axes`` 将 ``value`` 矩阵的值嵌入到 ``x`` 矩阵。返回一个新的 Tensor 而不是视图。 ``axes`` 需要与 ``starts``, ``ends`` 和 ``strides`` 尺寸一致。 图示展示了示例二 ——一个形状为 [3, 9] 的张量 x,在 axis 1 上使用 slice scatter 操作,将 [3, 1] 的 value 张量嵌入到指定的范围内。图中显示了原始张量、value 张量以及操作后的结果。 diff --git a/docs/api/paddle/sparse/add_cn.rst b/docs/api/paddle/sparse/add_cn.rst index cb7922b9155..037e8958d61 100644 --- a/docs/api/paddle/sparse/add_cn.rst +++ b/docs/api/paddle/sparse/add_cn.rst @@ -8,7 +8,7 @@ add 输入 :attr:`x` 与输入 :attr:`y` 逐元素相加,并将各个位置的输出元素保存到返回结果中。 -输入 :attr:`x` 与输入 :attr:`y` 必须为相同形状且为相同稀疏压缩格式(同为 `SparseCooTensor` 或同为 `SparseCsrTensor`),如果同为 `SparseCooTensor` 则 `sparse_dim` 也需要相同。 +输入 :attr:`x` 与输入 :attr:`y` 必须为相同形状且为相同稀疏压缩格式(同为 ``SparseCooTensor`` 或同为 ``SparseCsrTensor``),如果同为 ``SparseCooTensor`` 则 ``sparse_dim`` 也需要相同。 等式为: diff --git a/docs/api/paddle/sparse/addmm_cn.rst b/docs/api/paddle/sparse/addmm_cn.rst index 77ee62b5d49..9307f1c80e3 100644 --- a/docs/api/paddle/sparse/addmm_cn.rst +++ b/docs/api/paddle/sparse/addmm_cn.rst @@ -6,9 +6,9 @@ addmm .. py:function:: paddle.sparse.addmm(input, x, y, beta=1.0, alpha=1.0, name=None) .. note:: - 该 API 从 `CUDA 11.0` 开始支持。 + 该 API 从 ``CUDA 11.0`` 开始支持。 -对输入 :attr:`x` 与输入 :attr:`y` 求稀疏矩阵乘法,并将 `input` 加到计算结果上。 +对输入 :attr:`x` 与输入 :attr:`y` 求稀疏矩阵乘法,并将 ``input`` 加到计算结果上。 数学公式: @@ -27,7 +27,7 @@ addmm input[DenseTensor] + x[SparseCooTensor] @ y[DenseTensor] -> out[DenseTensor] -该 API 支持反向传播,`input` 、 `x` 、 `y` 的维度相同且>=2D,不支持自动广播。 +该 API 支持反向传播,``input`` 、 ``x`` 、 ``y`` 的维度相同且>=2D,不支持自动广播。 参数 ::::::::: @@ -40,7 +40,7 @@ addmm 返回 ::::::::: -SparseTensor|DenseTensor: 其 Tensor 类型、dtype、shape 与 `input` 相同。 +SparseTensor|DenseTensor: 其 Tensor 类型、dtype、shape 与 ``input`` 相同。 代码示例 diff --git a/docs/api/paddle/sparse/cast_cn.rst b/docs/api/paddle/sparse/cast_cn.rst index 40786194030..f3bd2c18bd4 100644 --- a/docs/api/paddle/sparse/cast_cn.rst +++ b/docs/api/paddle/sparse/cast_cn.rst @@ -5,8 +5,8 @@ cast .. py:function:: paddle.sparse.cast(x, index_dtype=None, value_dtype=None, name=None) -输入 :attr:`x` 为 `SparseCooTensor` 或 `SparseCsrTensor` 。将稀疏 Tensor 的 index 转换为 `index_dtype` 类型 -( `SparseCsrTensor` 的 index 指: `crows` 与 `col` ),value 转换为 `value_dtype` 类型, +输入 :attr:`x` 为 ``SparseCooTensor`` 或 ``SparseCsrTensor`` 。将稀疏 Tensor 的 index 转换为 ``index_dtype`` 类型 +( ``SparseCsrTensor`` 的 index 指: ``crows`` 与 ``col`` ),value 转换为 ``value_dtype`` 类型, 参数 ::::::::: diff --git a/docs/api/paddle/sparse/divide_cn.rst b/docs/api/paddle/sparse/divide_cn.rst index 445eabdd59e..1ec6b736c2b 100644 --- a/docs/api/paddle/sparse/divide_cn.rst +++ b/docs/api/paddle/sparse/divide_cn.rst @@ -7,7 +7,7 @@ divide 输入 :attr:`x` 与输入 :attr:`y` 逐元素相除,并将各个位置的输出元素保存到返回结果中。 -输入 :attr:`x` 与输入 :attr:`y` 必须为相同形状且为相同稀疏压缩格式(同为 `SparseCooTensor` 或同为 `SparseCsrTensor`),如果同为 `SparseCooTensor` 则 `sparse_dim` 也需要相同。 +输入 :attr:`x` 与输入 :attr:`y` 必须为相同形状且为相同稀疏压缩格式(同为 ``SparseCooTensor`` 或同为 ``SparseCsrTensor``),如果同为 ``SparseCooTensor`` 则 ``sparse_dim`` 也需要相同。 等式为: @@ -25,7 +25,7 @@ divide 返回 ::::::::: -多维稀疏 Tensor, 数据类型和压缩格式与 :attr:`x` 相同,如果是整数相除则返回数据类型为 `float32`。 +多维稀疏 Tensor, 数据类型和压缩格式与 :attr:`x` 相同,如果是整数相除则返回数据类型为 ``float32``。 代码示例 diff --git a/docs/api/paddle/sparse/isnan_cn.rst b/docs/api/paddle/sparse/isnan_cn.rst index 8d793c64c6f..7e66317c811 100644 --- a/docs/api/paddle/sparse/isnan_cn.rst +++ b/docs/api/paddle/sparse/isnan_cn.rst @@ -5,7 +5,7 @@ isnan .. py:function:: paddle.sparse.isnan(x, name=None) -返回输入 tensor 的每一个值是否为 `+/-NaN`,要求 输入 :attr:`x` 为 `SparseCooTensor` 或 `SparseCsrTensor` 。 +返回输入 tensor 的每一个值是否为 ``+/-NaN``,要求 输入 :attr:`x` 为 ``SparseCooTensor`` 或 ``SparseCsrTensor`` 。 参数 ::::::::: @@ -14,7 +14,7 @@ isnan 返回 ::::::::: -多维稀疏 ``Tensor``,每个元素是一个 bool 值,表示输入 :attr:`x` 的每个元素是否为 `+/-NaN`,稀疏格式与 :attr:`x` 相同 。 +多维稀疏 ``Tensor``,每个元素是一个 bool 值,表示输入 :attr:`x` 的每个元素是否为 ``+/-NaN``,稀疏格式与 :attr:`x` 相同 。 代码示例 diff --git a/docs/api/paddle/sparse/mask_as_cn.rst b/docs/api/paddle/sparse/mask_as_cn.rst index ed350913989..0d727854818 100644 --- a/docs/api/paddle/sparse/mask_as_cn.rst +++ b/docs/api/paddle/sparse/mask_as_cn.rst @@ -5,7 +5,7 @@ mask_as .. py:function:: paddle.sparse.mask_as(x, mask, name=None) -使用稀疏张量 `mask` 的索引过滤输入的稠密张量 `x`,并生成相应格式的稀疏张量。输入的 `x` 和 `mask` 必须具有相同的形状,且返回的稀疏张量具有与 `mask` 相同的索引,即使对应的索引中存在 `零` 值。 +使用稀疏张量 ``mask`` 的索引过滤输入的稠密张量 ``x``,并生成相应格式的稀疏张量。输入的 ``x`` 和 ``mask`` 必须具有相同的形状,且返回的稀疏张量具有与 ``mask`` 相同的索引,即使对应的索引中存在 ``零`` 值。 参数 ::::::::: @@ -15,7 +15,7 @@ mask_as 返回 ::::::::: -SparseTensor: 其稀疏格式、dtype、shape 均与 `mask` 相同。 +SparseTensor: 其稀疏格式、dtype、shape 均与 ``mask`` 相同。 代码示例 diff --git a/docs/api/paddle/sparse/masked_matmul_cn.rst b/docs/api/paddle/sparse/masked_matmul_cn.rst index 4d60b41c7ab..dea0c5a0b37 100644 --- a/docs/api/paddle/sparse/masked_matmul_cn.rst +++ b/docs/api/paddle/sparse/masked_matmul_cn.rst @@ -6,10 +6,10 @@ masked_matmul .. py:function:: paddle.sparse.masked_matmul(x, y, mask, name=None) .. note:: - 该 API 从 `CUDA 11.3` 开始支持。 + 该 API 从 ``CUDA 11.3`` 开始支持。 -对输入 :attr:`x` 与输入 :attr:`y` 两个 DenseTensor 求矩阵乘法,同时根据稀疏 Tensor `mask` 进行压缩存储, -返回一个与 `mask` 布局一致的稀疏 Tensor。 +对输入 :attr:`x` 与输入 :attr:`y` 两个 DenseTensor 求矩阵乘法,同时根据稀疏 Tensor ``mask`` 进行压缩存储, +返回一个与 ``mask`` 布局一致的稀疏 Tensor。 输入、输出的格式对应关系如下: @@ -19,8 +19,8 @@ masked_matmul x[DenseTensor] @ y[DenseTensor] * mask[SparseCsrTensor] -> out[SparseCsrTensor] -该 API 支持反向传播,`x` 和 `y` 必须 >= 2D,不支持自动广播。 `x` 的 shape 应该为 `[*, M, K]` , `y` 的 shape 应该为 -`[*, K, N]` , `mask` 的 shape 应该为 `[*, M, N]` 。其中 `*` 为 0 或者批维度。 +该 API 支持反向传播,``x`` 和 ``y`` 必须 >= 2D,不支持自动广播。 ``x`` 的 shape 应该为 ``[*, M, K]`` , ``y`` 的 shape 应该为 +``[*, K, N]`` , ``mask`` 的 shape 应该为 ``[*, M, N]`` 。其中 ``*`` 为 0 或者批维度。 参数 ::::::::: @@ -31,7 +31,7 @@ masked_matmul 返回 ::::::::: -SparseTensor: 其 Tensor 类型、dtype、shape 均与 `mask` 相同。 +SparseTensor: 其 Tensor 类型、dtype、shape 均与 ``mask`` 相同。 代码示例 diff --git a/docs/api/paddle/sparse/matmul_cn.rst b/docs/api/paddle/sparse/matmul_cn.rst index 929ba721b62..669f5b0c780 100644 --- a/docs/api/paddle/sparse/matmul_cn.rst +++ b/docs/api/paddle/sparse/matmul_cn.rst @@ -6,9 +6,9 @@ matmul .. py:function:: paddle.sparse.matmul(x, y, name=None) .. note:: - 该 API 从 `CUDA 11.0` 开始支持。 + 该 API 从 ``CUDA 11.0`` 开始支持。 -对输入 :attr:`x` 与输入 :attr:`y` 求稀疏矩阵乘法,`x` 为稀疏 Tensor, `y` 可为稀疏 Tensor 或稠密 Tensor。 +对输入 :attr:`x` 与输入 :attr:`y` 求稀疏矩阵乘法,``x`` 为稀疏 Tensor, ``y`` 可为稀疏 Tensor 或稠密 Tensor。 输入、输出的格式对应关系如下: @@ -22,8 +22,8 @@ matmul x[SparseCooTensor] @ y[DenseTensor] -> out[DenseTensor] -该 API 支持反向传播,`x` 和 `y` 必须 >= 2D,不支持自动广播。 `x` 的 shape 应该为 `[*, M, K]` , `y` 的 shape 应该为 -`[*, K, N]` ,其中 `*` 为 0 或者批维度。 +该 API 支持反向传播,``x`` 和 ``y`` 必须 >= 2D,不支持自动广播。 ``x`` 的 shape 应该为 ``[*, M, K]`` , ``y`` 的 shape 应该为 +``[*, K, N]`` ,其中 ``*`` 为 0 或者批维度。 参数 ::::::::: @@ -33,7 +33,7 @@ matmul 返回 ::::::::: -SparseTensor|DenseTensor: 其 Tensor 类型由 `x` 和 `y` 共同决定,数据类型与输入相同。 +SparseTensor|DenseTensor: 其 Tensor 类型由 ``x`` 和 ``y`` 共同决定,数据类型与输入相同。 代码示例 diff --git a/docs/api/paddle/sparse/multiply_cn.rst b/docs/api/paddle/sparse/multiply_cn.rst index 4b7b582ea7e..1cb025f4c9f 100644 --- a/docs/api/paddle/sparse/multiply_cn.rst +++ b/docs/api/paddle/sparse/multiply_cn.rst @@ -7,7 +7,7 @@ multiply 输入 :attr:`x` 与输入 :attr:`y` 逐元素相乘,并将各个位置的输出元素保存到返回结果中。 -输入 :attr:`x` 与输入 :attr:`y` 必须为相同形状且为相同稀疏压缩格式(同为 `SparseCooTensor` 或同为 `SparseCsrTensor`),如果同为 `SparseCooTensor` 则 `sparse_dim` 也需要相同。 +输入 :attr:`x` 与输入 :attr:`y` 必须为相同形状且为相同稀疏压缩格式(同为 ``SparseCooTensor`` 或同为 ``SparseCsrTensor``),如果同为 ``SparseCooTensor`` 则 ``sparse_dim`` 也需要相同。 等式为: diff --git a/docs/api/paddle/sparse/mv_cn.rst b/docs/api/paddle/sparse/mv_cn.rst index 869f79cd940..b6f2cac20e6 100644 --- a/docs/api/paddle/sparse/mv_cn.rst +++ b/docs/api/paddle/sparse/mv_cn.rst @@ -6,9 +6,9 @@ mv .. py:function:: paddle.sparse.mv(x, vec, name=None) .. note:: - 该 API 从 `CUDA 11.0` 开始支持。 + 该 API 从 ``CUDA 11.0`` 开始支持。 -输入 :attr:`x` 为稀疏矩阵,输入 :attr:`vec` 为稠密向量,对 `x` 与 `vec` 计算矩阵与向量相乘。 +输入 :attr:`x` 为稀疏矩阵,输入 :attr:`vec` 为稠密向量,对 ``x`` 与 ``vec`` 计算矩阵与向量相乘。 输入、输出的格式对应关系如下: @@ -18,8 +18,8 @@ mv x[SparseCooTensor] @ vec[DenseTensor] -> out[DenseTensor] -该 API 支持反向传播。输入 `x` 的 shape 应该为 `[M, N]` ,输入 `vec` 的 shape 应该为 `[N]` ,输出 `out` -的 shape 为 `[M]` 。 +该 API 支持反向传播。输入 ``x`` 的 shape 应该为 ``[M, N]`` ,输入 ``vec`` 的 shape 应该为 ``[N]`` ,输出 ``out`` +的 shape 为 ``[M]`` 。 参数 ::::::::: diff --git a/docs/api/paddle/sparse/nn/MaxPool3D_cn.rst b/docs/api/paddle/sparse/nn/MaxPool3D_cn.rst index e51dec69ce8..60cd307a090 100644 --- a/docs/api/paddle/sparse/nn/MaxPool3D_cn.rst +++ b/docs/api/paddle/sparse/nn/MaxPool3D_cn.rst @@ -5,8 +5,8 @@ MaxPool3D .. py:class:: paddle.sparse.nn.MaxPool3D(kernel_size, stride=None, padding=0, ceil_mode=False, return_mask=False, data_format="NDHWC", name=None) -构建 `MaxPool3D` 类的一个可调用对象,其将构建一个三维最大池化层,根据输入参数 `kernel_size`, `stride`, -`padding` 等参数对稀疏输入特征做最大池化操作。 输入输出都是 "NDHWC" 格式,其中 N 是批大小, C 是特征的通道数, H 是特征的高, W 是特征的宽。 +构建 ``MaxPool3D`` 类的一个可调用对象,其将构建一个三维最大池化层,根据输入参数 ``kernel_size``, ``stride``, +``padding`` 等参数对稀疏输入特征做最大池化操作。 输入输出都是 "NDHWC" 格式,其中 N 是批大小, C 是特征的通道数, H 是特征的高, W 是特征的宽。 参数 ::::::::: diff --git a/docs/api/paddle/sparse/nn/Softmax_cn.rst b/docs/api/paddle/sparse/nn/Softmax_cn.rst index a360b7a9346..bf377fa73fd 100644 --- a/docs/api/paddle/sparse/nn/Softmax_cn.rst +++ b/docs/api/paddle/sparse/nn/Softmax_cn.rst @@ -4,11 +4,11 @@ Softmax ------------------------------- .. py:class:: paddle.sparse.nn.Softmax(axis=-1, name=None) -稀疏 Softmax 激活层,输入 :attr:`x` 为 `SparseCooTensor` 或 `SparseCsrTensor` ,创建一个可调用对象以计算输入 `x` 的 `Softmax` 。 +稀疏 Softmax 激活层,输入 :attr:`x` 为 ``SparseCooTensor`` 或 ``SparseCsrTensor`` ,创建一个可调用对象以计算输入 ``x`` 的 ``Softmax`` 。 -当输入 `x` 为 `SparseCsrTensor` 时,仅支持 axis=-1,是由于 Csr 稀疏存储格式,更适合按行读取数据。 +当输入 ``x`` 为 ``SparseCsrTensor`` 时,仅支持 axis=-1,是由于 Csr 稀疏存储格式,更适合按行读取数据。 -如果将 `x` 从稀疏矩阵转换为稠密矩阵, :math:`i` 代表行数, :math:`j` 代表列数,且 axis=-1 时有如下公式: +如果将 ``x`` 从稀疏矩阵转换为稠密矩阵, :math:`i` 代表行数, :math:`j` 代表列数,且 axis=-1 时有如下公式: .. math:: softmax_ij = \frac{\exp(x_ij - max_j(x_ij))}{\sum_j(exp(x_ij - max_j(x_ij))} diff --git a/docs/api/paddle/sparse/nn/functional/attention_cn.rst b/docs/api/paddle/sparse/nn/functional/attention_cn.rst index 5f36ad1c5cc..027676a1279 100644 --- a/docs/api/paddle/sparse/nn/functional/attention_cn.rst +++ b/docs/api/paddle/sparse/nn/functional/attention_cn.rst @@ -5,16 +5,16 @@ attention .. py:function:: paddle.sparse.nn.functional.attention(query, key, value, sparse_mask, key_padding_mask=None, attn_mask=None, name=None) .. note:: - 该 API 从 `CUDA 11.7` 开始支持。 + 该 API 从 ``CUDA 11.7`` 开始支持。 稀疏 Attention,该 API 内部使用 SparseCsrTensor 来存储 Transformer 模块中的 attention 矩阵,从而达到减少显存占用、提高性能的目的。 -参数 `sparse_mask` 描述了稀疏矩阵的非 0 元素索引布局。 +参数 ``sparse_mask`` 描述了稀疏矩阵的非 0 元素索引布局。 .. math:: result = softmax(\frac{ Q * K^T }{\sqrt{d}}) * V -其中:矩阵 `Q` `K` `V` 表示 attention 模块的三个输入 Tensor,其 shape 均为 `[batch_size, num_heads, seq_len, head_dim]` , -公式中的 `d` 代表 `head_dim` 。 +其中:矩阵 ``Q`` ``K`` ``V`` 表示 attention 模块的三个输入 Tensor,其 shape 均为 ``[batch_size, num_heads, seq_len, head_dim]`` , +公式中的 ``d`` 代表 ``head_dim`` 。 参数 :::::::::: @@ -32,7 +32,7 @@ attention 返回 ::::::::: -DenseTensor: 维度为 4,shape 为 `[batch_size, num_heads, seq_len, head_dim]` ,dtype 与输入相同。 +DenseTensor: 维度为 4,shape 为 ``[batch_size, num_heads, seq_len, head_dim]`` ,dtype 与输入相同。 代码示例 diff --git a/docs/api/paddle/sparse/nn/functional/max_pool3d_cn.rst b/docs/api/paddle/sparse/nn/functional/max_pool3d_cn.rst index c193c6f35a9..0ee856c8e67 100644 --- a/docs/api/paddle/sparse/nn/functional/max_pool3d_cn.rst +++ b/docs/api/paddle/sparse/nn/functional/max_pool3d_cn.rst @@ -5,7 +5,7 @@ max_pool3d .. py:function:: paddle.sparse.nn.functional.max_pool3d(x, kernel_size, stride=None, padding=0, ceil_mode=False, data_format="NDHWC", name=None) -该函数是一个三维最大池化函数,根据输入参数 `kernel_size` , `stride` , `padding` 等参数对输入 `x` 做最大池化操作。 +该函数是一个三维最大池化函数,根据输入参数 ``kernel_size`` , ``stride`` , ``padding`` 等参数对输入 ``x`` 做最大池化操作。 参数 ::::::::: diff --git a/docs/api/paddle/sparse/nn/functional/softmax_cn.rst b/docs/api/paddle/sparse/nn/functional/softmax_cn.rst index b2958e1aeee..2f0e6e6563b 100644 --- a/docs/api/paddle/sparse/nn/functional/softmax_cn.rst +++ b/docs/api/paddle/sparse/nn/functional/softmax_cn.rst @@ -4,11 +4,11 @@ softmax ------------------------------- .. py:function:: paddle.sparse.nn.functional.softmax(x, axis=-1, name=None) -稀疏 softmax 激活函数,要求 输入 :attr:`x` 为 `SparseCooTensor` 或 `SparseCsrTensor` 。 +稀疏 softmax 激活函数,要求 输入 :attr:`x` 为 ``SparseCooTensor`` 或 ``SparseCsrTensor`` 。 -当输入 `x` 为 `SparseCsrTensor` 时,仅支持 axis=-1,是由于 Csr 稀疏存储格式,更适合按行读取数据。 +当输入 ``x`` 为 ``SparseCsrTensor`` 时,仅支持 axis=-1,是由于 Csr 稀疏存储格式,更适合按行读取数据。 -如果将 `x` 从稀疏矩阵转换为稠密矩阵, :math:`i` 代表行数, :math:`j` 代表列数,且 axis=-1 时有如下公式: +如果将 ``x`` 从稀疏矩阵转换为稠密矩阵, :math:`i` 代表行数, :math:`j` 代表列数,且 axis=-1 时有如下公式: .. math:: softmax_ij = \frac{\exp(x_ij - max_j(x_ij))}{\sum_j(exp(x_ij - max_j(x_ij))} diff --git a/docs/api/paddle/sparse/pow_cn.rst b/docs/api/paddle/sparse/pow_cn.rst index 2c1cc91a97d..ce8d0aacee0 100644 --- a/docs/api/paddle/sparse/pow_cn.rst +++ b/docs/api/paddle/sparse/pow_cn.rst @@ -6,7 +6,7 @@ pow .. py:function:: paddle.sparse.pow(x, factor, name=None) -逐元素计算 :attr:`x` 的幂函数,幂的系数为 `factor`,要求 输入 :attr:`x` 为 `SparseCooTensor` 或 `SparseCsrTensor` 。 +逐元素计算 :attr:`x` 的幂函数,幂的系数为 ``factor``,要求 输入 :attr:`x` 为 ``SparseCooTensor`` 或 ``SparseCsrTensor`` 。 数学公式: diff --git a/docs/api/paddle/sparse/subtract_cn.rst b/docs/api/paddle/sparse/subtract_cn.rst index 73a0e8b705d..75f3559c3f2 100644 --- a/docs/api/paddle/sparse/subtract_cn.rst +++ b/docs/api/paddle/sparse/subtract_cn.rst @@ -8,7 +8,7 @@ subtract 输入 :attr:`x` 与输入 :attr:`y` 逐元素相减,并将各个位置的输出元素保存到返回结果中。 -输入 :attr:`x` 与输入 :attr:`y` 必须为相同形状且为相同稀疏压缩格式(同为 `SparseCooTensor` 或同为 `SparseCsrTensor`),如果同为 `SparseCooTensor` 则 `sparse_dim` 也需要相同。 +输入 :attr:`x` 与输入 :attr:`y` 必须为相同形状且为相同稀疏压缩格式(同为 ``SparseCooTensor`` 或同为 ``SparseCsrTensor``),如果同为 ``SparseCooTensor`` 则 ``sparse_dim`` 也需要相同。 等式为: diff --git a/docs/api/paddle/static/Overview_cn.rst b/docs/api/paddle/static/Overview_cn.rst index f9076270dcc..22368446c1f 100644 --- a/docs/api/paddle/static/Overview_cn.rst +++ b/docs/api/paddle/static/Overview_cn.rst @@ -24,10 +24,10 @@ Program 相关 API :widths: 10, 30 " :ref:`append_backward ` ", "向 main_program 添加反向" - " :ref:`default_main_program ` ", "获取当前用于存储 OP 和 Tensor 描述信息的 `default main program` " - " :ref:`default_startup_program ` ", "获取默认/全局的 `startup program` " + " :ref:`default_main_program ` ", "获取当前用于存储 OP 和 Tensor 描述信息的 ``default main program`` " + " :ref:`default_startup_program ` ", "获取默认/全局的 ``startup program`` " " :ref:`Program ` ", "飞桨用 Program 动态描述整个计算图" - " :ref:`program_guard ` ", "配合 with 语句将算子和变量添加进指定的 `main program` 和 `startup program` " + " :ref:`program_guard ` ", "配合 with 语句将算子和变量添加进指定的 ``main program`` 和 ``startup program`` " " :ref:`set_program_state ` ", "设置 Program 的参数和优化器信息" " :ref:`normalize_program ` ", "根据指定的 feed_vars 和 fetch_vars,优化 program" @@ -125,8 +125,8 @@ io 相关 API :header: "API 名称", "API 功能" :widths: 10, 30 - " :ref:`cpu_places ` ", "创建 `paddle.CPUPlace` 对象" - " :ref:`cuda_places ` ", "创建 `paddle.CUDAPlace` 对象" + " :ref:`cpu_places ` ", "创建 ``paddle.CPUPlace`` 对象" + " :ref:`cuda_places ` ", "创建 ``paddle.CUDAPlace`` 对象" " :ref:`device_guard ` ", "用于指定 OP 运行设备的上下文管理器" .. _about_metrics: diff --git a/docs/api/paddle/static/Variable_cn.rst b/docs/api/paddle/static/Variable_cn.rst index 38fd37d09bb..62c39f23208 100644 --- a/docs/api/paddle/static/Variable_cn.rst +++ b/docs/api/paddle/static/Variable_cn.rst @@ -7,9 +7,9 @@ Variable .. note:: - 1. 请不要直接调用 `Variable` 的构造函数,因为这会造成严重的错误发生! + 1. 请不要直接调用 ``Variable`` 的构造函数,因为这会造成严重的错误发生! - 2. 在静态图形模式下:请使用 `Block.create_var` 创建一个静态的 `Variable`,该静态的 `Variable` 在使用 :ref:`cn_api_paddle_static_Executor` 执行前是没有实际数据的。 + 2. 在静态图形模式下:请使用 ``Block.create_var`` 创建一个静态的 ``Variable``,该静态的 ``Variable`` 在使用 :ref:`cn_api_paddle_static_Executor` 执行前是没有实际数据的。 在 Paddle 静态图模式中,OP 的每个输入和输出都是 :ref:`api_guide_Variable`。多数情况下,:ref:`api_guide_Variable` 用于保存不同种类的数据或训练标签。 @@ -103,7 +103,7 @@ get_value(scope=None) **参数** - - scope ( Scope,可选 ) - 从指定的 ``scope`` 中获取 :ref:`api_guide_Variable` 的值。如果 ``scope`` 为 ``None``,通过 `paddle.static.global_scope()` 获取全局/默认作用域实例,并从中获取 :ref:`api_guide_Variable` 的值;否则,从指定的 ``scope`` 中获取 :ref:`api_guide_Variable` 的值。 + - scope ( Scope,可选 ) - 从指定的 ``scope`` 中获取 :ref:`api_guide_Variable` 的值。如果 ``scope`` 为 ``None``,通过 ``paddle.static.global_scope()`` 获取全局/默认作用域实例,并从中获取 :ref:`api_guide_Variable` 的值;否则,从指定的 ``scope`` 中获取 :ref:`api_guide_Variable` 的值。 **返回** @@ -121,7 +121,7 @@ set_value(value, scope=None) **参数** - value ( Tensor|ndarray ) - :ref:`api_guide_Variable` 的值。 - - scope ( Scope,可选 ) - 将 :ref:`api_guide_Variable` 的值设置到指定的 ``scope`` 中。如果 ``scope`` 为 ``None``,通过 `paddle.static.global_scope()` 获取全局/默认作用域实例,并将 :ref:`api_guide_Variable` 的值设置到这个用域实例中;否则,将 :ref:`api_guide_Variable` 的值设置到指定的 ``scope`` 中。 + - scope ( Scope,可选 ) - 将 :ref:`api_guide_Variable` 的值设置到指定的 ``scope`` 中。如果 ``scope`` 为 ``None``,通过 ``paddle.static.global_scope()`` 获取全局/默认作用域实例,并将 :ref:`api_guide_Variable` 的值设置到这个用域实例中;否则,将 :ref:`api_guide_Variable` 的值设置到指定的 ``scope`` 中。 **返回** diff --git a/docs/api/paddle/trunc_cn.rst b/docs/api/paddle/trunc_cn.rst index 00957027d6d..6a9cfbf301e 100644 --- a/docs/api/paddle/trunc_cn.rst +++ b/docs/api/paddle/trunc_cn.rst @@ -6,7 +6,7 @@ trunc .. py:function:: paddle.trunc(input, name=None) -将输入 `Tensor` 的小数部分置 0,返回置 0 后的 `Tensor`,如果输入 `Tensor` 的数据类型为整数,则不做处理。 +将输入 ``Tensor`` 的小数部分置 0,返回置 0 后的 ``Tensor``,如果输入 ``Tensor`` 的数据类型为整数,则不做处理。 参数 diff --git a/docs/api/paddle/vision/Overview_cn.rst b/docs/api/paddle/vision/Overview_cn.rst index dc596121c56..d2fe7e20fcd 100644 --- a/docs/api/paddle/vision/Overview_cn.rst +++ b/docs/api/paddle/vision/Overview_cn.rst @@ -161,8 +161,8 @@ paddle.vision 目录是飞桨在视觉领域的高层 API。具体如下: " :ref:`RandomErasing ` ", "擦除图像中随机选择的矩形区域内的像素" " :ref:`SaturationTransform ` ", "调整图像饱和度" " :ref:`to_grayscale ` ", "对图像进行灰度化" - " :ref:`to_tensor ` ", "将`PIL.Image`或`numpy.ndarray`转为`paddle.Tensor`" - " :ref:`ToTensor ` ", "将`PIL.Image`或`numpy.ndarray`转为`paddle.Tensor`" + " :ref:`to_tensor ` ", "将 ``PIL.Image`` 或 ``numpy.ndarray`` 转为 ``paddle.Tensor``" + " :ref:`ToTensor ` ", "将 ``PIL.Image`` 或 ``numpy.ndarray`` 转为 ``paddle.Tensor``" " :ref:`Transpose ` ", "将输入的图像数据更改为目标格式" " :ref:`vflip ` ", "垂直翻转图像" diff --git a/docs/api/paddle/vision/ops/prior_box_cn.rst b/docs/api/paddle/vision/ops/prior_box_cn.rst index ea7e9b02642..1a06349bf13 100644 --- a/docs/api/paddle/vision/ops/prior_box_cn.rst +++ b/docs/api/paddle/vision/ops/prior_box_cn.rst @@ -5,7 +5,7 @@ prior_box .. py:function:: paddle.vision.ops.prior_box(input, image, min_sizes, max_sizes=None, aspect_ratios=[1.], variance=[0.1, 0.1, 0.2, 0.2], flip=False, clip=False, steps=[0.0, 0.0], offset=0.5, min_max_aspect_ratios_order=False, name=None) -为 SSD(Single Shot MultiBox Detector) 系列目标检测算法生成候选框,是在输入的每个位置生成 N 个候选框, N 由 `min_sizes`, `max_sizes` 和 `aspect_ratios` 的数目决定,候选框的尺寸在 (min_size, max_size) 之间,该尺寸根据 `aspect_ratios` 在序列中生成。 +为 SSD(Single Shot MultiBox Detector) 系列目标检测算法生成候选框,是在输入的每个位置生成 N 个候选框, N 由 ``min_sizes``, ``max_sizes`` 和 ``aspect_ratios`` 的数目决定,候选框的尺寸在 (min_size, max_size) 之间,该尺寸根据 ``aspect_ratios`` 在序列中生成。 参数