未验证 提交 6d5fc220 编写于 作者: Z Zhong Hui 提交者: GitHub

Fix segment api document. (#35818)

上级 0f74e5e7
...@@ -17,9 +17,4 @@ from .math import segment_mean ...@@ -17,9 +17,4 @@ from .math import segment_mean
from .math import segment_max from .math import segment_max
from .math import segment_min from .math import segment_min
__all__ = [ __all__ = []
'segment_sum',
'segment_mean',
'segment_max',
'segment_min',
]
...@@ -12,22 +12,15 @@ ...@@ -12,22 +12,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # 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.layer_helper import LayerHelper, in_dygraph_mode
from paddle.fluid.data_feeder import check_variable_and_dtype from paddle.fluid.data_feeder import check_variable_and_dtype
from paddle import _C_ops from paddle import _C_ops
__all__ = []
def segment_sum(data, segment_ids, name=None): def segment_sum(data, segment_ids, name=None):
""" r"""
Segment Sum Operator. Segment Sum Operator.
This operator sums the elements of input `data` which with This operator sums the elements of input `data` which with
...@@ -40,6 +33,9 @@ def segment_sum(data, segment_ids, name=None): ...@@ -40,6 +33,9 @@ def segment_sum(data, segment_ids, name=None):
segment_ids (Tensor): A 1-D tensor, which have the same size segment_ids (Tensor): A 1-D tensor, which have the same size
with the first dimension of input data. with the first dimension of input data.
Available data type is int32, int64. 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: Returns:
output (Tensor): the reduced result. output (Tensor): the reduced result.
...@@ -76,7 +72,7 @@ def segment_sum(data, segment_ids, name=None): ...@@ -76,7 +72,7 @@ def segment_sum(data, segment_ids, name=None):
def segment_mean(data, segment_ids, name=None): def segment_mean(data, segment_ids, name=None):
""" r"""
Segment mean Operator. Segment mean Operator.
Ihis operator calculate the mean value of input `data` which Ihis operator calculate the mean value of input `data` which
...@@ -90,6 +86,8 @@ def segment_mean(data, segment_ids, name=None): ...@@ -90,6 +86,8 @@ def segment_mean(data, segment_ids, name=None):
segment_ids (tensor): a 1-d tensor, which have the same size segment_ids (tensor): a 1-d tensor, which have the same size
with the first dimension of input data. with the first dimension of input data.
available data type is int32, int64. 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: Returns:
output (Tensor): the reduced result. output (Tensor): the reduced result.
...@@ -127,7 +125,7 @@ def segment_mean(data, segment_ids, name=None): ...@@ -127,7 +125,7 @@ def segment_mean(data, segment_ids, name=None):
def segment_min(data, segment_ids, name=None): def segment_min(data, segment_ids, name=None):
""" r"""
Segment min operator. Segment min operator.
This operator calculate the minimum elements of input `data` which with This operator calculate the minimum elements of input `data` which with
...@@ -140,6 +138,9 @@ def segment_min(data, segment_ids, name=None): ...@@ -140,6 +138,9 @@ def segment_min(data, segment_ids, name=None):
segment_ids (tensor): a 1-d tensor, which have the same size segment_ids (tensor): a 1-d tensor, which have the same size
with the first dimension of input data. with the first dimension of input data.
available data type is int32, int64. 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: Returns:
output (Tensor): the reduced result. output (Tensor): the reduced result.
...@@ -176,12 +177,12 @@ def segment_min(data, segment_ids, name=None): ...@@ -176,12 +177,12 @@ def segment_min(data, segment_ids, name=None):
def segment_max(data, segment_ids, name=None): def segment_max(data, segment_ids, name=None):
""" r"""
Segment max operator. Segment max operator.
This operator calculate the maximum elements of input `data` which with This operator calculate the maximum elements of input `data` which with
the same index in `segment_ids`. 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`. where max is over j such that `segment_ids[j] == i`.
Args: Args:
...@@ -189,6 +190,8 @@ def segment_max(data, segment_ids, name=None): ...@@ -189,6 +190,8 @@ def segment_max(data, segment_ids, name=None):
segment_ids (tensor): a 1-d tensor, which have the same size segment_ids (tensor): a 1-d tensor, which have the same size
with the first dimension of input data. with the first dimension of input data.
available data type is int32, int64. 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: Returns:
output (Tensor): the reduced result. output (Tensor): the reduced result.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册