From 35ef41800fe0aacf80b4f2f9b6272a169cb226e3 Mon Sep 17 00:00:00 2001 From: Li Min <11663212+limin2021@users.noreply.github.com> Date: Mon, 16 Aug 2021 20:54:30 +0800 Subject: [PATCH] Fix typos in English docs for diag and diagflat. (#34869) * Fix typos in english docs for diag and diagflat. --- paddle/fluid/operators/diag_v2_op.cc | 2 +- python/paddle/fluid/layers/nn.py | 6 ++++-- python/paddle/tensor/creation.py | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/operators/diag_v2_op.cc b/paddle/fluid/operators/diag_v2_op.cc index ae78517182a..dd5ad739506 100644 --- a/paddle/fluid/operators/diag_v2_op.cc +++ b/paddle/fluid/operators/diag_v2_op.cc @@ -79,7 +79,7 @@ class DiagV2OpMaker : public framework::OpProtoAndCheckerMaker { "Tensor. The default value is 0.") .SetDefault(0.0f); AddComment(R"DOC( - If ``x`` is a vector (1-D tensor), a 2-D square tensor whth the elements of ``x`` as the diagonal is returned. + If ``x`` is a vector (1-D tensor), a 2-D square tensor with the elements of ``x`` as the diagonal is returned. If ``x`` is a matrix (2-D tensor), a 1-D tensor with the diagonal elements of ``x`` is returned. diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 656f1efe493..6251bdf165a 100755 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -13342,7 +13342,7 @@ def shuffle_channel(x, group, name=None): [[0.7, 0.8], [0.8, 0.9]]]] Given group: 2 - then we get a 4-D tensor out whth the same shape of input: + then we get a 4-D tensor out with the same shape of input: out.shape = (1, 4, 2, 2) out.data = [[[[0.1, 0.2], [0.2, 0.3]], @@ -13370,7 +13370,9 @@ def shuffle_channel(x, group, name=None): Examples: .. code-block:: python - import paddle.fluid as fluid + import paddle + import paddle.fluid as fluid + paddle.enable_static() input = fluid.data(name='input', shape=[None,4,2,2], dtype='float32') out = fluid.layers.shuffle_channel(x=input, group=2) """ diff --git a/python/paddle/tensor/creation.py b/python/paddle/tensor/creation.py index 6354e877879..71968d67ed6 100644 --- a/python/paddle/tensor/creation.py +++ b/python/paddle/tensor/creation.py @@ -777,7 +777,7 @@ def meshgrid(*args, **kwargs): def diagflat(x, offset=0, name=None): """ - If ``x`` is a vector (1-D tensor), a 2-D square tensor whth the elements of ``x`` as the diagonal is returned. + If ``x`` is a vector (1-D tensor), a 2-D square tensor with the elements of ``x`` as the diagonal is returned. If ``x`` is a tensor (more than 1-D), a 2-D square tensor with the elements of flattened ``x`` as the diagonal is returned. @@ -902,7 +902,7 @@ def diagflat(x, offset=0, name=None): def diag(x, offset=0, padding_value=0, name=None): """ - If ``x`` is a vector (1-D tensor), a 2-D square tensor whth the elements of ``x`` as the diagonal is returned. + If ``x`` is a vector (1-D tensor), a 2-D square tensor with the elements of ``x`` as the diagonal is returned. If ``x`` is a matrix (2-D tensor), a 1-D tensor with the diagonal elements of ``x`` is returned. -- GitLab