Skip to content

Commit 6d5fc22

Browse files
authored
Fix segment api document. (#35818)
1 parent 0f74e5e commit 6d5fc22

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

python/paddle/incubate/tensor/__init__.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,4 @@
1717
from .math import segment_max
1818
from .math import segment_min
1919

20-
__all__ = [
21-
'segment_sum',
22-
'segment_mean',
23-
'segment_max',
24-
'segment_min',
25-
]
20+
__all__ = []

python/paddle/incubate/tensor/math.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,15 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__all__ = [
16-
'segment_sum',
17-
'segment_mean',
18-
'segment_max',
19-
'segment_min',
20-
]
21-
22-
import paddle
23-
2415
from paddle.fluid.layer_helper import LayerHelper, in_dygraph_mode
2516
from paddle.fluid.data_feeder import check_variable_and_dtype
2617
from paddle import _C_ops
2718

19+
__all__ = []
20+
2821

2922
def segment_sum(data, segment_ids, name=None):
30-
"""
23+
r"""
3124
Segment Sum Operator.
3225
3326
This operator sums the elements of input `data` which with
@@ -40,6 +33,9 @@ def segment_sum(data, segment_ids, name=None):
4033
segment_ids (Tensor): A 1-D tensor, which have the same size
4134
with the first dimension of input data.
4235
Available data type is int32, int64.
36+
name (str, optional): Name for the operation (optional, default is None).
37+
For more information, please refer to :ref:`api_guide_Name`.
38+
4339
Returns:
4440
output (Tensor): the reduced result.
4541
@@ -76,7 +72,7 @@ def segment_sum(data, segment_ids, name=None):
7672

7773

7874
def segment_mean(data, segment_ids, name=None):
79-
"""
75+
r"""
8076
Segment mean Operator.
8177
8278
Ihis operator calculate the mean value of input `data` which
@@ -90,6 +86,8 @@ def segment_mean(data, segment_ids, name=None):
9086
segment_ids (tensor): a 1-d tensor, which have the same size
9187
with the first dimension of input data.
9288
available data type is int32, int64.
89+
name (str, optional): Name for the operation (optional, default is None).
90+
For more information, please refer to :ref:`api_guide_Name`.
9391
9492
Returns:
9593
output (Tensor): the reduced result.
@@ -127,7 +125,7 @@ def segment_mean(data, segment_ids, name=None):
127125

128126

129127
def segment_min(data, segment_ids, name=None):
130-
"""
128+
r"""
131129
Segment min operator.
132130
133131
This operator calculate the minimum elements of input `data` which with
@@ -140,6 +138,9 @@ def segment_min(data, segment_ids, name=None):
140138
segment_ids (tensor): a 1-d tensor, which have the same size
141139
with the first dimension of input data.
142140
available data type is int32, int64.
141+
name (str, optional): Name for the operation (optional, default is None).
142+
For more information, please refer to :ref:`api_guide_Name`.
143+
143144
Returns:
144145
output (Tensor): the reduced result.
145146
@@ -176,19 +177,21 @@ def segment_min(data, segment_ids, name=None):
176177

177178

178179
def segment_max(data, segment_ids, name=None):
179-
"""
180+
r"""
180181
Segment max operator.
181182
182183
This operator calculate the maximum elements of input `data` which with
183184
the same index in `segment_ids`.
184-
It computes a tensor such that $out_i = \\min_{j} data_{j}$
185+
It computes a tensor such that $out_i = \\max_{j} data_{j}$
185186
where max is over j such that `segment_ids[j] == i`.
186187
187188
Args:
188189
data (tensor): a tensor, available data type float32, float64.
189190
segment_ids (tensor): a 1-d tensor, which have the same size
190191
with the first dimension of input data.
191192
available data type is int32, int64.
193+
name (str, optional): Name for the operation (optional, default is None).
194+
For more information, please refer to :ref:`api_guide_Name`.
192195
193196
Returns:
194197
output (Tensor): the reduced result.

0 commit comments

Comments
 (0)