Skip to content

Commit 439a265

Browse files
committed
Better trim dot
1 parent b000e0d commit 439a265

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

python/paddle/fluid/layers/control_flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ def max_sequence_len(rank_table):
736736
rank_table(${rank_table_type}): ${rank_table_comment}.
737737
738738
Returns:
739-
(${out_type}): ${out_comment}
739+
(${out_type}): ${out_comment}.
740740
"""
741741
helper = LayerHelper("max_seqence_len", **locals())
742742
res = helper.create_tmp_variable(dtype="int64")

python/paddle/fluid/layers/layer_function_generator.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ def templatedoc():
238238
Decorated function.
239239
"""
240240

241+
def trim_ending_dot(msg):
242+
return msg.rstrip('.')
243+
241244
def __impl__(func):
242245
op_proto = OpProtoHolder.instance().get_op_proto(func.__name__)
243246
tmpl = string.Template(func.__doc__)
@@ -249,19 +252,22 @@ def __impl__(func):
249252
comment += line
250253
comment += "\n"
251254

252-
args = {"comment": comment}
255+
args = {"comment": trim_ending_dot(comment)}
253256
for each_input in op_proto.inputs:
254257
input_name = _convert_(each_input.name)
255-
args["{0}_comment".format(input_name)] = each_input.comment
258+
args["{0}_comment".format(input_name)] = trim_ending_dot(
259+
each_input.comment)
256260
args["{0}_type".format(input_name)] = "Variable"
257261
for each_attr in op_proto.attrs:
258262
input_name = _convert_(each_attr.name)
259-
args["{0}_comment".format(input_name)] = each_attr.comment
263+
args["{0}_comment".format(input_name)] = trim_ending_dot(
264+
each_attr.comment)
260265
args["{0}_type".format(input_name)] = _type_to_str_(each_attr.type)
261266

262267
for each_opt in op_proto.outputs:
263268
output_name = _convert_(each_opt.name)
264-
args["{0}_comment".format(output_name)] = each_opt.comment
269+
args["{0}_comment".format(output_name)] = trim_ending_dot(
270+
each_opt.comment)
265271
args["{0}_type".format(output_name)] = "Variable"
266272
func.__doc__ = tmpl.substitute(args)
267273
return func

python/paddle/fluid/layers/tensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def fill_constant_batch_size_like(input,
296296
output_dim_idx(${output_dim_idx_type}): ${output_dim_idx_comment}.
297297
298298
Returns:
299-
${out_comment}
299+
${out_comment}.
300300
"""
301301
helper = LayerHelper("fill_constant_batch_size_like", **locals())
302302
out = helper.create_tmp_variable(dtype=dtype)

0 commit comments

Comments
 (0)