From 6d5fc2206481eca18fa072bf9d7d372e478007cd Mon Sep 17 00:00:00 2001 From: Zhong Hui Date: Fri, 17 Sep 2021 14:12:11 +0800 Subject: [PATCH] Fix segment api document. (#35818) --- python/paddle/incubate/tensor/__init__.py | 7 +---- python/paddle/incubate/tensor/math.py | 31 +++++++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/python/paddle/incubate/tensor/__init__.py b/python/paddle/incubate/tensor/__init__.py index ea1018409a..b585a0dd4d 100644 --- a/python/paddle/incubate/tensor/__init__.py +++ b/python/paddle/incubate/tensor/__init__.py @@ -17,9 +17,4 @@ from .math import segment_mean from .math import segment_max from .math import segment_min -__all__ = [ - 'segment_sum', - 'segment_mean', - 'segment_max', - 'segment_min', -] +__all__ = [] diff --git a/python/paddle/incubate/tensor/math.py b/python/paddle/incubate/tensor/math.py index f3cb8d5051..9f577d5ff3 100644 --- a/python/paddle/incubate/tensor/math.py +++ b/python/paddle/incubate/tensor/math.py @@ -12,22 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -__all__ = [ - 'segment_sum', - 'segment_mean', - 'segment_max', - 'segment_min', -] - -import paddle - from paddle.fluid.layer_helper import LayerHelper, in_dygraph_mode from paddle.fluid.data_feeder import check_variable_and_dtype from paddle import _C_ops +__all__ = [] + def segment_sum(data, segment_ids, name=None): - """ + r""" Segment Sum Operator. This operator sums the elements of input `data` which with @@ -40,6 +33,9 @@ def segment_sum(data, segment_ids, name=None): segment_ids (Tensor): A 1-D tensor, which have the same size with the first dimension of input data. Available data type is int32, int64. + name (str, optional): Name for the operation (optional, default is None). + For more information, please refer to :ref:`api_guide_Name`. + Returns: output (Tensor): the reduced result. @@ -76,7 +72,7 @@ def segment_sum(data, segment_ids, name=None): def segment_mean(data, segment_ids, name=None): - """ + r""" Segment mean Operator. Ihis operator calculate the mean value of input `data` which @@ -90,6 +86,8 @@ def segment_mean(data, segment_ids, name=None): segment_ids (tensor): a 1-d tensor, which have the same size with the first dimension of input data. available data type is int32, int64. + name (str, optional): Name for the operation (optional, default is None). + For more information, please refer to :ref:`api_guide_Name`. Returns: output (Tensor): the reduced result. @@ -127,7 +125,7 @@ def segment_mean(data, segment_ids, name=None): def segment_min(data, segment_ids, name=None): - """ + r""" Segment min operator. This operator calculate the minimum elements of input `data` which with @@ -140,6 +138,9 @@ def segment_min(data, segment_ids, name=None): segment_ids (tensor): a 1-d tensor, which have the same size with the first dimension of input data. available data type is int32, int64. + name (str, optional): Name for the operation (optional, default is None). + For more information, please refer to :ref:`api_guide_Name`. + Returns: output (Tensor): the reduced result. @@ -176,12 +177,12 @@ def segment_min(data, segment_ids, name=None): def segment_max(data, segment_ids, name=None): - """ + r""" Segment max operator. This operator calculate the maximum elements of input `data` which with the same index in `segment_ids`. - It computes a tensor such that $out_i = \\min_{j} data_{j}$ + It computes a tensor such that $out_i = \\max_{j} data_{j}$ where max is over j such that `segment_ids[j] == i`. Args: @@ -189,6 +190,8 @@ def segment_max(data, segment_ids, name=None): segment_ids (tensor): a 1-d tensor, which have the same size with the first dimension of input data. available data type is int32, int64. + name (str, optional): Name for the operation (optional, default is None). + For more information, please refer to :ref:`api_guide_Name`. Returns: output (Tensor): the reduced result. -- GitLab