fix a bug when using fp16 training & gradient clipping (#5426)
fix a bug when using fp16 training & gradient clipping (#5426)

* fix a bug when using fp16 training & gradient clipping

* fix format

* format

Co-authored-by: yk x <b4c60fd2941fb18e28bbdd2b607ae9b05dc1b8b3@gmail.com>
Co-authored-by: epwalsh <8aa1dcec45eed2823433bd3f497ad7c510fe0357@gmail.com>
allenai/allennlp,allenai/allennlp,allenai/allennlp,allenai/allennlp