Skip to content

Commit 71988fa

Browse files
authored
Merge pull request #11287 from reyoung/feature/remove_op_role_from_doc
Do not generate doc for op_role and op_attr_name
2 parents 0aa9546 + 2dd66ef commit 71988fa

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

python/paddle/fluid/framework.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,13 @@ def get_op_proto(self, type):
363363
raise ValueError("Operator \"%s\" has not been registered." % type)
364364
return self.op_proto_map[type]
365365

366+
@staticmethod
367+
def generated_op_attr_names():
368+
return {
369+
core.op_proto_and_checker_maker.kOpRoleAttrName(),
370+
core.op_proto_and_checker_maker.kOpRoleVarAttrName()
371+
}
372+
366373

367374
class Operator(object):
368375
"""

python/paddle/fluid/layers/layer_function_generator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ def _type_to_str_(tp):
7575
buf.write(str(each_input.dispensable))
7676
buf.write('\n')
7777

78+
skip_attrs = OpProtoHolder.generated_op_attr_names()
79+
7880
for each_attr in op_proto.attrs:
81+
if each_attr.name in skip_attrs:
82+
continue
7983
buf.write(' ')
8084
buf.write(each_attr.name)
8185
buf.write(' (')

0 commit comments

Comments
 (0)