From 7d5d3710b7444586b2633e614771aa9bec0e7fe0 Mon Sep 17 00:00:00 2001 From: sandyhouse Date: Fri, 26 Mar 2021 00:08:36 +0800 Subject: [PATCH] fix ut, test=develop --- python/paddle/fluid/optimizer.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/python/paddle/fluid/optimizer.py b/python/paddle/fluid/optimizer.py index b55831c700515..2aa918bf80661 100755 --- a/python/paddle/fluid/optimizer.py +++ b/python/paddle/fluid/optimizer.py @@ -4136,20 +4136,6 @@ def _add_op_device_attr_for_op(self, op, idx, block): # For LRSched ops, we should put them on all sub-programs to # make sure each sub-program update the lr correctly op._set_attr(self._op_device_key, "gpu:all") - elif op.type == "sum" and self._is_backward_op(op): - # For sum ops that compute the sum of @RENAMED@ vars - for name in op.desc.input_arg_names(): - assert '@RENAME@' in name, \ - "The op must be sum used to accumulate renamed vars." - assert len(op.desc.output_arg_names()) == 1 - out_name = op.desc.output_arg_names()[0] - post_op = self._find_post_op(block.ops, op, out_name) - assert post_op.has_attr(self._op_device_key), \ - "{} has no op_device attr for var {}".format( - post_op.type, out_name) - device = post_op.attr(self._op_device_key) - assert device, "The post op must have op_device set." - op._set_attr(self._op_device_key, device) elif (op.type == "cast" or op.type == "scale") and self._is_backward_op(op): prev_op = self._find_real_prev_op(block.ops, op, @@ -4386,7 +4372,7 @@ def _insert_sendrecv_ops_for_boundaries(self, block): inputs={'X': [var]}, outputs={'Out': [var]}, attrs={ - self._op_device_key: cur_device, + self._op_device_key: prev_device, self._op_role_key: self._op_role.Backward, 'ring_id': ring_id, })