Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
FeixLiu committed Aug 27, 2021
1 parent 77112f8 commit e9f4e2f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions python/paddle/fluid/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5313,12 +5313,16 @@ def _accumulate_gradients_with_fuse(self, main_block, fp16, fused_size):
# we set the dtype of float and fp16 both to 2.
# Under this way, the fused vars' shape for float and fp16 are all [128]
"user_defined_size_of_dtype": 2,
"set_constant": core.is_compiled_with_npu(),
"constant": float(0.0),
"copy_data": False,
"use_align": True,
"dtype": grads[0].dtype,
self._op_role_key: self._op_role.Backward
self._op_role_key: self._op_role.Backward,
# On npu, the nan/inf check login is different with gpu.
# If there are some not initialized sections in the fused var,
# and the value in those sections are nan/inf, it will trigger the nan/inf check.
# To avoid these problematic triggers, set constant is needed for npu
"set_constant": core.is_compiled_with_npu(),
"constant": float(0.0),
})
offset += 1
# For the gradient_merged_fused_var, given a init value during the coalesce op
Expand Down

1 comment on commit e9f4e2f

@paddle-bot-old
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulation! Your pull request passed all required CI. You could ask reviewer(s) to approve and merge. 🎉

Please sign in to comment.