File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
python/paddle/fluid/transpiler Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 49
49
OP_ROLE_VAR_ATTR_NAME = core .op_proto_and_checker_maker .kOpRoleVarAttrName ()
50
50
RPC_OP_ROLE_ATTR_NAME = op_role_attr_name = core .op_proto_and_checker_maker .kOpRoleAttrName (
51
51
)
52
+ OPT_OP_ROLE_ATTR_VALUE = core .op_proto_and_checker_maker .OpRole .Optimize
52
53
RPC_OP_ROLE_ATTR_VALUE = core .op_proto_and_checker_maker .OpRole .RPC
53
54
DIST_OP_ROLE_ATTR_VALUE = core .op_proto_and_checker_maker .OpRole .Dist
54
55
LR_SCHED_OP_ROLE_ATTR_VALUE = core .op_proto_and_checker_maker .OpRole .LRSched
@@ -1717,8 +1718,10 @@ def _get_lr_ops(self):
1717
1718
lr_ops = []
1718
1719
block = self .origin_program .global_block ()
1719
1720
for op in block .ops :
1720
- if int (op .attr (RPC_OP_ROLE_ATTR_NAME )) | int (
1721
- LR_SCHED_OP_ROLE_ATTR_VALUE ) > 0 :
1721
+ role_id = int (op .attr (RPC_OP_ROLE_ATTR_NAME ))
1722
+ if role_id == int (LR_SCHED_OP_ROLE_ATTR_VALUE ) or \
1723
+ role_id == int (LR_SCHED_OP_ROLE_ATTR_VALUE ) | \
1724
+ int (OPT_OP_ROLE_ATTR_VALUE ):
1722
1725
lr_ops .append (op )
1723
1726
log ("append lr op: " , op .type )
1724
1727
return lr_ops
You can’t perform that action at this time.
0 commit comments