From 5720fedf6b2a1db33f083265b11c2a3e9a45c1fc Mon Sep 17 00:00:00 2001 From: ForFishes <2282912238@qq.com> Date: Mon, 28 Sep 2020 11:21:18 +0800 Subject: [PATCH] replace rank with ndim --- python/paddle/fluid/layers/nn.py | 2 +- python/paddle/tensor/manipulation.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 0990a7a5e20..e467245a917 100755 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -8589,7 +8589,7 @@ def scatter_nd(index, updates, shape, name=None): seen :code:`scatter_nd_add` . This op is the inverse of the :code:`gather_nd` op. Args: - index (Tensor): The index input with rank > 1 and index.shape[-1] <= len(shape). + index (Tensor): The index input with ndim > 1 and index.shape[-1] <= len(shape). Its dtype should be int32 or int64 as it is used as indexes. updates (Tensor): The updated value of scatter_nd op. Its dtype should be float32, float64. It must have the shape index.shape[:-1] + shape[index.shape[-1]:] diff --git a/python/paddle/tensor/manipulation.py b/python/paddle/tensor/manipulation.py index 5acea082d3c..a6bbcbc3cfe 100644 --- a/python/paddle/tensor/manipulation.py +++ b/python/paddle/tensor/manipulation.py @@ -980,10 +980,10 @@ def scatter_nd_add(x, index, updates, name=None): Output is obtained by applying sparse addition to a single value or slice in a Tensor. - :attr:`x` is a Tensor with rank :math:`R` - and :attr:`index` is a Tensor with rank :math:`K` . Thus, :attr:`index` + :attr:`x` is a Tensor with ndim :math:`R` + and :attr:`index` is a Tensor with ndim :math:`K` . Thus, :attr:`index` has shape :math:`[i_0, i_1, ..., i_{K-2}, Q]` where :math:`Q \leq R` . :attr:`updates` - is a Tensor with rank :math:`K - 1 + R - Q` and its + is a Tensor with ndim :math:`K - 1 + R - Q` and its shape is :math:`index.shape[:-1] + x.shape[index.shape[-1]:]` . According to the :math:`[i_0, i_1, ..., i_{K-2}]` of :attr:`index` , @@ -1018,7 +1018,7 @@ def scatter_nd_add(x, index, updates, name=None): Args: x (Tensor): The x input. Its dtype should be float32, float64. - index (Tensor): The index input with rank > 1 and index.shape[-1] <= x.rank. + index (Tensor): The index input with ndim > 1 and index.shape[-1] <= x.ndim. Its dtype should be int32 or int64 as it is used as indexes. updates (Tensor): The updated value of scatter_nd_add op, and it must have the same dtype as x. It must have the shape index.shape[:-1] + x.shape[index.shape[-1]:]. -- GitLab